Skip to content

Fix click event bug caused by DomRenderer replaceChildren behavior#5249

Merged
Tyriar merged 1 commit intoxtermjs:masterfrom
jtbandes:fix-click-not-delivered
Dec 20, 2024
Merged

Fix click event bug caused by DomRenderer replaceChildren behavior#5249
Tyriar merged 1 commit intoxtermjs:masterfrom
jtbandes:fix-click-not-delivered

Conversation

@jtbandes
Copy link
Copy Markdown
Contributor

Fixes an issue where click events on the terminal would not be sent when using DomRenderer. (Fixes #5220)

As described in #5220 (comment), as far as I can tell, the issue happens because the clicked element (event.target) is replaced (via replaceChildren) between mousedown & mouseup. This caused the browser to never deliver a click event at all. Adding pointer-events: none; makes it so the descendants of .xterm-rows are not considered, and the event.target is always the parent .xterm-screen element for both mousedown & mouseup events — and the click events are delivered as expected.

@jerch
Copy link
Copy Markdown
Member

jerch commented Dec 14, 2024

@jtbandes Wow thats a very neat trick to get it working. Thx for finding and fixing this :)

@jtbandes
Copy link
Copy Markdown
Contributor Author

@Tyriar friendly ping on this when you get a chance 🙂

Copy link
Copy Markdown
Member

@Tyriar Tyriar left a comment

Choose a reason for hiding this comment

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

LGTM, I thought this would work, great suggestion!

@Tyriar Tyriar added this to the 6.0.0 milestone Dec 20, 2024
@Tyriar Tyriar self-assigned this Dec 20, 2024
@Tyriar Tyriar merged commit ce095b3 into xtermjs:master Dec 20, 2024
@jtbandes jtbandes deleted the fix-click-not-delivered branch January 9, 2025 22:16
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.

Terminal eats click events

3 participants