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

Fails to detect when absolute positioned dom is covering Japanese text #2337

Open
melink14 opened this issue Dec 20, 2024 · 0 comments
Open
Labels

Comments

@melink14
Copy link
Owner

Example: New reddit browse page post snippets are covered in a big anchor tag that blocks all text.

One idea that worked in a simple devtools test is to save the blocking dom, recheck for the range and then add it back. Something like:

const savedStartNode = range.startContainer';
const replacement = document.creeateElement('div');
savedStartNode.replaceWith(replacement);
range = document.caretRangeAtPosition(...);
// <insert code here>
replacement.replaceWith(savedStartNode)

Hopefully this would keep everything intact and be invisible to the user but I'm not 100% sure.

Decisions to make:

  • When to apply this logic?
    • Whenever start container is absolute? (probably this should be a condition though maybe there are other display styles that can cover content)
    • Whenever start container is not text node (has no data)? This would also help clean up our types.
    • Could see if any results are returned first and if not then could re-run with the node removed to see if better results.

We'll also need to fix #2336 since the event target will certainly be wrong if the original event target was the absolutely positioned element.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant