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

✨ (grapher) fixed tooltip position on mobile / TAS-520 #3679

Closed

Conversation

sophiamersmann
Copy link
Member

@sophiamersmann sophiamersmann commented Jun 3, 2024

Makes it so that mobile tooltips stick to the bottom (see screenshot below).

Notes:

  • If the tooltip content is taller than the allowed max-width, then the tooltip becomes scrollable (that's why the tooltip stays on screen even after an interaction has ended; the tooltip can be dismissed by clicking anywhere on the screen)
  • For tooltips that have a "total" row (e.g. stacked area charts), the total row is moved to the top for mobile tooltips (so that it's visible by default, even if the tooltip is scrollable)
  • Tooltips are automatically dismissed when the Grapher is scrolled out of view
    • This works by utilizing Grapher's intersection observer. There was a weird bug on iOS Safari where the intersection observer simply didn't fire when Grapher was out of view. For some reason, that doesn't happen if the threshold is set to some small number (instead of 0, which is the default)
    • Ideally, I would want to dismiss tooltips a bit earlier, but I didn't want to set up a second intersection observer just for that...
    • Note that previously, after scrolling a Grapher into view, we would disconnect the intersection observer. Now, we keep it around – I don't think this should be a problem, but wanted to mention it.

To do:

  • Map tooltips are broken
Screenshot 2024-06-05 at 14 54 46

Copy link
Member Author

sophiamersmann commented Jun 3, 2024

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @sophiamersmann and the rest of your teammates on Graphite Graphite

@owidbot
Copy link
Contributor

owidbot commented Jun 3, 2024

Quick links (staging server):

Site Admin Wizard

Login: ssh owid@staging-site-mobile-tooltips-fixed

SVG tester:

Number of differences (default views): 1342 (fc5a7d) ❌
Number of differences (all views): 685 (00cf2c) ❌

Edited: 2024-06-24 09:45:06 UTC
Execution time: 1.19 seconds

@sophiamersmann sophiamersmann force-pushed the mobile-tooltips-prevent-scrolling branch from 61b4d11 to 8234922 Compare June 3, 2024 14:33
@sophiamersmann sophiamersmann force-pushed the mobile-tooltips-fixed branch 2 times, most recently from 92b7f06 to cda5df4 Compare June 4, 2024 14:22
@sophiamersmann sophiamersmann changed the title ✨ (grapher) fixed tooltip position on mobile ✨ (grapher) fixed tooltip position on mobile / TAS-520 Jun 4, 2024
Copy link

@sophiamersmann
Copy link
Member Author

Good to go once map tooltips are fixed. To be continued...

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

Successfully merging this pull request may close these issues.

2 participants