-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Terminal eats click
events
#5220
Comments
I think we do prevent bubbling sometimes as we handle mouse events in various ways. Seems a bit weird that click works sometimes and sometimes not though. |
Yes, even with a capture event listener, I saw the events were sometimes missing. I think this means xtermjs is not intentionally stopping the events, but they are actually never delivered. |
@Tyriar @jerch I discovered that this is because of this refresh() call inside SelectionSerivce.handleMouseDown:
This ends up calling DomRenderer.renderRows() which uses replaceChildren(): xterm.js/src/browser/renderer/dom/DomRenderer.ts Lines 451 to 452 in 41e8ae3
It turns out that when a child is replaced during a click, the browser does not fire a You can see that clicking the background ( Screen.Recording.2024-12-06.at.2.51.43.PM.movHowever, I'm not sure what else to do if calling refresh() here is a problem? Perhaps we need to try changing the elements' text content without fully replacing them? (Do you know if there's a reason replaceChildren was used?) |
|
Yeah, I think we cannot get rid of I wonder though, if we could let the event bubble through before the actual content change happens. 🤔 |
I think that would mean waiting until the click event (or mousemove?) to render the new selection. That might work if you are willing to make that change. Another idea - maybe some well placed |
This might work actually, I don't think we depend on any click events in .xterm-rows as that doesn't exist when the webgl addon is used. |
It seems to work 🙏 🎉 #5249 |
When adding
mousedown
,mouseup
, andclick
listeners on the terminal container element, and then clicking on the terminal, I observe that theclick
is sometimes not delivered. (On macOS with a Magic Trackpad, I noticed that theclick
event almost always works when using tap to click and tapping with a single finger, but when actually pressing the trackpad to click it, theclick
event is usually not delivered.)I suspect this is a clue: right-clicking on the logged
event.target
and clicking "Reveal in Elements panel" sometimes shows "Node cannot be found in the current page". Perhaps the browser is not delivering theclick
event because the mousedown/mouseup are not on matching elements, or the clicked element is removed before the click finishes.Screen.Recording.2024-11-19.at.4.49.26.PM.mov
Details
Note: same behavior seems to happen with 5.6.0 beta as well: https://codesandbox.io/p/sandbox/xtermjs-test-forked-qfng37
Steps to reproduce
https://codesandbox.io/p/sandbox/xtermjs-test-forked-c5s8g4
Or visit https://c5s8g4.csb.app/ and view the console
The text was updated successfully, but these errors were encountered: