Closed sophiamersmann closed 7 hours ago
This stack of pull requests is managed by Graphite. Learn more about stacking.
Join @sophiamersmann and the rest of your teammates on Graphite
Quick links (staging server): Site | Admin | Wizard |
---|
Login: ssh owid@staging-site-mobile-tooltips-prevent-scrolling
Edited: 2024-06-24 09:05:23 UTC Execution time: 1.26 seconds
Thanks for your reviews! This is good to go but I want to ship it in concert with follow-up PRs, so closing it for now, but will be continued...
Line charts and stacked area charts listen to move events on mobile to show a tooltip, but don't prevent scrolling, which makes the experience of interacting with the tooltip a bit jumpy (see video below).
This PR makes it so that scrolling is disabled when interacting with the chart area.
Implementation detail: All React event listeners are by default passive, which means that calling
event.preventDefault()
has no effect. That's why we need to attach the event listener to the DOM ourselves (technically, only the move event needs this but I moved them all to thecomponentDidMount
method so that they're all defined in the same place)https://github.com/owid/owid-grapher/assets/12461810/d2f4ab22-fc10-44c9-8353-0cb2aabb146e