-
Notifications
You must be signed in to change notification settings - Fork 25
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
Neighborhood hover not working on our maps in Firefox #3777 #3796
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to be working nicely! I tested on Chrome and Firefox for now. Are you using a Mac? If so, have you checked that it's working on Safari as well?
I also added a couple of comments throughout the code to address. Nothing major!
// Add listeners to popup so the popup closes when the mouse leaves the popup area. | ||
neighborhoodTooltip._content.onmouseout = function (e) { | ||
if (!e.toElement || !e.toElement.closest('.mapboxgl-popup')) { | ||
// Clear timeout when entering new toolTip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very small thing, but just take a quick look through the Style Guide. Want comments ending in a period, etc. Sorry, still need to get the linter set up to do this stuff automatically!
// Clear timeout when entering new toolTip | ||
neighborhoodTooltip._content.onmouseenter = function () { | ||
if (tooltipTimeout) { | ||
clearTimeout(tooltipTimeout); // Clear the timeout if the mouse enters the tooltip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment also feels redundant. The outer comment summarizes what happens here well enough, and what you're doing is simple enough. I think it would be cleaner to just rewrite it like:
// Clear timeout when entering a tooltip.
neighborhoodTooltip._content.onmouseenter = function () {
if (tooltipTimeout) clearTimeout(tooltipTimeout);
};
// Clear timeout when entering new toolTip | ||
neighborhoodTooltip._content.onmouseenter = function () { | ||
if (tooltipTimeout) { | ||
clearTimeout(tooltipTimeout); // Clear the timeout if the mouse enters the tooltip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And when we call clearTimeout
we're actually never unsetting the tooltipTimeout
variable. So after the first tooltip opens, tooltipTimeout
will never be falsey. Which is fine, because we can keep trying to clear the timeout for a timer that's already been cleared. Similarly, we can keep calling clearTimeout
on undefined
! So maybe let's just not bother with checking if tooltipTimeout
is defined to simplify things even more:
// Clear timeout when entering a tooltip.
neighborhoodTooltip._content.onmouseenter = function () { clearTimeout(tooltipTimeout); };
And we can simplify in the same way throughout
And make sure to pull in most recent changes to develop! You were behind by 25 commits or so, but I pulled in changes while I was testing this time! |
Resolves #3777
Configured tooltopTimout variable to handle flickering on toolbox when hovered by adding slight delay when removing tool tip which gives the user time to move their mouse onto the tooltip.
Before/After screenshots (if applicable)
before.mp4
after.mp4
Testing instructions
Things to check before submitting the PR