Hide tooltip after clicking on a chart to display more info (cosmetic change) #18103
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Breaking change
Proposed change
Follow up to #18036.
Desktop browsers fire mouseout when a new DOM element appears between a chart and the mouse pointer but mobile browsers never send it, they would only send
touchend
ortouchcancel
. But chartjs usestouchend
to emulatemouseup
only.Not having
mouseout
on mobile causes tooltip to stay visible after opening More Info dialog. Not a big deal as it can be hidden by clicking on the tooltip or elsewhere but it would be nicer if it hid automatically.This PR additionally sends
mouseout
event to the chart's canvas to force tooltip to hide.While this is a workaround, it should be harmless.
Other possible way to fix this would be creating PR to chart.js to somehow make
touchend
to also automatically callmouseout
. I am not sure if that would be a better option as I am worried that some people may want to keep tooltip visible onmouseup
for some specific use-cases. Here in these three cases we are sure we want tooltips to hide so maybe it is more sensible to simply add this workaround.Type of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: