Skip to content
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

Chrome text selection in neighboring element glitch #1

Open
sidewayss opened this issue Oct 10, 2024 · 3 comments
Open

Chrome text selection in neighboring element glitch #1

sidewayss opened this issue Oct 10, 2024 · 3 comments
Labels
browser Browser bug or misbehavior known behavior

Comments

@sidewayss
Copy link
Owner

sidewayss commented Oct 10, 2024

Using the in-number.html app page as an example:
When document.activeElement === this && this._dom.activeElement === null in Chrome and you click repeatedly on the spinner buttons, the browser starts selecting text in the next element on the page, the "Font:" label.

  1. A bug should be filed for Chrome.
  2. A workaround should be found until it's fixed or if the bug is rejected. It's going to be messy, but another element will probably need to take the focus inside the shadow DOM. Right now the only focusable element is the input.
@sidewayss sidewayss changed the title in-number: Shadow DOM .activeElement == null in Chrome selects text in the next element in-number: Shadow DOM .activeElement == null in Chrome glitch Oct 10, 2024
@sidewayss
Copy link
Owner Author

sidewayss commented Oct 14, 2024

This stackoverflow answer might be the solution: https://stackoverflow.com/a/28654521/4941356

EDIT: tried it and failed. Neither the anchor element wrapper nor tabindex worked.

AGAIN: added an anchor to the template, outside of SVG, succeeded at giving it focus, and the text-selection glitch does not go away.

So it looks like the null activeElement may be irrelevant.

@sidewayss sidewayss changed the title in-number: Shadow DOM .activeElement == null in Chrome glitch in-number: Chrome text selection in neighboring element glitch Oct 16, 2024
@sidewayss sidewayss changed the title in-number: Chrome text selection in neighboring element glitch input-num - Chrome text selection in neighboring element glitch Oct 16, 2024
@sidewayss sidewayss added the browser Browser bug or misbehavior label Oct 18, 2024
@sidewayss
Copy link
Owner Author

I have worked around this by calling event.preventDefault() in the mousedown handler when the target is a spin button. It will be in the next commit.

I am leaving this issue open and labeling it as "browser" so that I am reminded to submit an issue for Chrome.

@sidewayss sidewayss changed the title input-num - Chrome text selection in neighboring element glitch Chrome text selection in neighboring element glitch Jan 7, 2025
@sidewayss
Copy link
Owner Author

See https://issues.chromium.org/issues/388066440

The previously mentioned workaround stopped working. I have a new one that leaves the text unselected, but flickers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
browser Browser bug or misbehavior known behavior
Projects
None yet
Development

No branches or pull requests

1 participant