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

How to get the real insert point in a "beforeInput" event ? #61

Open
sspi opened this issue Apr 14, 2017 · 2 comments
Open

How to get the real insert point in a "beforeInput" event ? #61

sspi opened this issue Apr 14, 2017 · 2 comments

Comments

@sspi
Copy link

sspi commented Apr 14, 2017

Example :

ab<em>cd</em>

If you select bc from left to right (focus node is in <em/>) and type X, you will get :
a<em>Xd</em>

If you select bc from right to left (focus node is before <em/>) and type X, you will get :
aX<em>d</em>

But the 2 events (type=beforeInput, inputType=insertText) are identical : getTargetRanges() will not help.

The Selection.focusNode and Selection.focusOffset are missing in the InputEvent in order to know where the insertion will take place.

@sspi
Copy link
Author

sspi commented Apr 14, 2017

Note : this issue does not exist in Chrome Canary because the focus seems to always be moved to the range start point before the insertion.
In this specification, do we consider the insert point must always be at the first StaticRange InputEvent.getgetTargetRanges()[0] start point ?

@johanneswilm
Copy link
Contributor

This is a good point. We should take it up in the next telco.

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

No branches or pull requests

2 participants