Skip to content

Fix hoveranywhere/clickanywhere events over editable shapes#7788

Open
alexshoe wants to merge 2 commits intomasterfrom
fix-shape-anywhere-events
Open

Fix hoveranywhere/clickanywhere events over editable shapes#7788
alexshoe wants to merge 2 commits intomasterfrom
fix-shape-anywhere-events

Conversation

@alexshoe
Copy link
Copy Markdown
Contributor

@alexshoe alexshoe commented May 1, 2026

Description

Fixes #7787.

Editable shapes were swallowing plotly_hover / plotly_click events, so hoveranywhere / clickanywhere never fired over them.

Root cause:
dragElement.init sets element.style.pointerEvents = 'all' inline on the shape path so it can receive drag events. That override beats the CSS rule that normally keeps the shape transparent to events, so mouse events stop at the shape and never reach the nsewdrag rect where hoveranywhere / clickanywhere are wired up.

The Fix:
Forward mousemove and click from the shape path to Fx.hover / Fx.click (with the shape's subplot id) when hoveranywhere / clickanywhere is enabled and the user isn't mid-drag. This mirrors the pattern already used by the hover layer in graph_interact.js.

@alexshoe alexshoe requested review from camdecoster and emilykl May 1, 2026 21:33
@alexshoe alexshoe marked this pull request as ready for review May 1, 2026 21:33
@camdecoster
Copy link
Copy Markdown
Contributor

Could you please provide testing instructions? I'm happy to paste a mock into devtools.

@alexshoe
Copy link
Copy Markdown
Contributor Author

alexshoe commented May 4, 2026

@camdecoster here's the file that I used to test this:
click_hover_anywhere_test.html

Copy link
Copy Markdown
Contributor

@camdecoster camdecoster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix seems good, but could you please add a test that checks for the proper events when using editable shapes?

Comment thread src/components/shapes/draw.js Outdated
Co-authored-by: Cameron DeCoster <cameron.decoster@gmail.com>
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.

[BUG]: hoveranywhere/clickanywhere events suppressed over editable shapes

2 participants