Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev/core#1790: Add short delay before closing tooltip elements #19082

Merged

Conversation

reneolivo
Copy link
Contributor

@reneolivo reneolivo commented Dec 1, 2020

Overview

This PR prevents tooltips from closing as long as the user's mouse is inside of the tooltip element.

Before

gif

After

gif

Technical Details

The crmtooltip function was updated so it only hides the tooltip after leaving the tooltip element, or after a 300ms delay.

The tooltip was closing too soon because the mouseout event was being triggered for the triggering element only.

The new code works because mouseleave is triggered every time the mouse mouse leaves one of the tooltip's elements. Since the triggering element is a parent of the tooltip's contents it will also get this event because of bubbling. We use tooltipLink.filter(':hover') to determine if the mouseleave event was triggered, but the mouse is still not inside any of the tooltip's children. In this case the tooltip is closed as usual.

@civibot
Copy link

civibot bot commented Dec 1, 2020

(Standard links)

@civibot civibot bot added the master label Dec 1, 2020
@reneolivo
Copy link
Contributor Author

Hello @eileenmcnaughton, this is the one we talked about before :)

@eileenmcnaughton
Copy link
Contributor

@reneolivo cool - I'll leave it to @colemanw to confirm

@colemanw
Copy link
Member

colemanw commented Dec 1, 2020

This looks good. There is a chance of the same code running twice due to the delay, but there's no harm in that as it's only removing css classes.

@colemanw colemanw merged commit 4a907a1 into civicrm:master Dec 1, 2020
@reneolivo reneolivo deleted the dev-core-1790-contact-card-delay branch December 3, 2020 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants