Open Unemyr opened 6 months ago
Thanks for sharing the issue @Unemyr. I'm hesitant to change the event type as this might break support for touch input or other non-mouse pointer types. I've opened an issue with Observable Plot in hopes that if might be addressed there: https://github.com/observablehq/plot/issues/2052
Thanks @jheer, that is a good approach too. Let's see what they say.
While using categorical charts (for example a Bar chart) with tooltips and the Toggle() function, it seems the two functions are impacting each other in a way that is quite annoying to users. As soon as tooltips is enabled, you will need to click 3 times (instead of 1 time as is desired and the way it works without tooltips) in order to filter and select that bar. This issue is observed across all major browsers I tried (Chrome, Safari, Edge, Firefox) but does not seem to be an issue on touch-based devices such as mobiles and tablets.
I have made a quick modification for proposed implementation as below - its just a one liner. It seems to work fine in all my tests, and also still good on mobile devices although the speed of selecting the bar seem to be slightly impacted on touch-devices.
[packages/plot/src/interactors/Toggle.js] One line 63, change the event listener type from 'pointerdown' to 'mousedown'
Apologize for not submitting a pull request directly for this, but my fork's commit also had other code changes that we should not apply into the main project.
As a side note, the interval() function are working fine, also with tooltips as the implementation approach is different.