The Wayback Machine - https://web.archive.org/web/20230220073901/https://github.com/chartjs/Chart.js/issues/7738
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

Tooltip on mobile should go away when I tap outside of canvas #7738

Open
lessless opened this issue Aug 30, 2020 · 7 comments
Open

Tooltip on mobile should go away when I tap outside of canvas #7738

lessless opened this issue Aug 30, 2020 · 7 comments

Comments

@lessless
Copy link

Expected Behavior

When I tap outside of a canvas tooltip should disappear, akin to what happens when I tap inside a canvas.
Or similarly to what happens on the desktop when I move mouse away from a circle.

Current Behavior

Tooltip stays visible when I tap outside of a canvas

Steps to Reproduce

Navigate to any tooltip example on mobile phone and tap on any data point.
You will see a tooltip.
Then tap outside of canvas and you will see that tooltip stays on a screen.

Context

It's expected that tooltips and hints are transient elements and they go away as soon as user leaves the context when they appeared.

Environment

@kurkle
Copy link
Member

kurkle commented Aug 30, 2020

Does that happen in master too? (https://www.chartjs.org/samples/master/tooltips/custom-line.html)
Works fine with android/chrome.

@lessless
Copy link
Author

@kurkle works as expected in Chrome. Even latest.

@ermish
Copy link

ermish commented Oct 29, 2020

I was able to reproduce this on iOS Safari.
This works on safari desktop, and other browsers.

I'll work on making a PR for this 👍

@kurkle
Copy link
Member

kurkle commented Mar 16, 2021

@ermish any progress?

@etimberg
Copy link
Member

Is this still an issue with Safari?

@kurkle
Copy link
Member

kurkle commented Nov 30, 2021

I could actually reproduce this with FF 93 in emulation mode:

iphone-click-outside

@kurkle
Copy link
Member

kurkle commented Nov 30, 2021

I could not find a event that FF on mobile emulation would fire on the canvas when tapping outside it. So as a workaround, one would need something like this:

if (event.target.tagName !== 'CANVAS') {
  const out = new Event('mouseout');
  for (const id of Object.keys(Chart.instances)) {
    Chart.instances[id].canvas.dispatchEvent(out);
  }
}

Note: FF on Android mobile does not need a workaround. So I'm not quite sure which devices actually need it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants