-
-
Notifications
You must be signed in to change notification settings - Fork 147
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
Something is blocking contenteditable from unselecting text #97
Comments
Did a bit of digging this morning and found that the offending line is this one: https://github.com/Simonwep/selection/blob/0a9fd4084f8e4e1dc1068aa05aed6651dbdafd95/src/index.ts#L166 What's the purpose of blocking the I cloned your package and removed this line and based on some of my basic tests it doesn't seem to impact anything. I of course am not as familiar with the code so could be overlooking something. If it is required for certain use cases, then perhaps this could be better set as a config option. |
Heavily, yes - if you do not prevent the start of a regular selection it'll signal the browser that you're selecting text. This causes the browser to handle things such as scrolling which in the end will the selection you wanted to fail.
I don't want to do that, the problem isn't obvious and it'd lead to unexpected results. I'll take a look at this and see what I can do :) |
I am wrong - or rather, it this was the case before v2. It is no longer a problem since the layouting got refactored. Fixed in 606b36f. Background: In v1 the whole "where is the reactangle - what elements are being touched" thingy wasn't really fully work out. In firefox if you had moved your mouse to the bottom of the page the whole thing broke since it couldn't handle both the page-wide scrolling and the local, container-based scrolling. This has been fixed around v2 (not sure anymore) and is no longer required :) |
What is the problem?
An event (or something else) is blocking selected text in a contenteditable from being unselected.
What is the current behavior?
When you select text in contenteditable and try to unselect it by clicking anywhere else in the document, it won't unselect the text.
Please provide the steps to reproduce and create a JSFiddle.
Note: If you don't initialise selection-js, this works perfectly fine.
https://jsfiddle.net/jamesbrndwgn/uevos4yg/13/
What is the expected behavior?
When clicking away from a contenteditable (i.e. blur), the text should unselect as per the regular browser behaviour.
Your environment:
The text was updated successfully, but these errors were encountered: