Conversation
I believe the expected behaviour is: * If the target already has focus, do nothing * Otherwise, if the target is focusable, set the selection to the last editable point in the element. Previously the spec was unconditionally focusing the target element (execpting some cases with file uploads), and therefore the letter of the spec was to never move the caret. This change updates it to only focus the target if it's not already the active element, and then move the caret to the end.
|
An open question is what to do if a child of the target already has focus e.g. if the Currently this will set the focus to the end of the |
|
I think I'm convinced that the child element case is reasonable for |
|
Please note that there is an upstream sync PR from @jgraham open which covers that proposed change and might merge soon: web-platform-tests/wpt#36226 |
|
@sadym-chromium maybe you could review as well? |
|
I ended up moving the difficult |
sadym-chromium
left a comment
There was a problem hiding this comment.
I'm a bit confused by the "content editable" option.
- It looks like the behaviour changed: It used to set a cursor anywhere inside the element, and now it selects the whole content. Was it intended?
- (out of scope of the this PR) Probably I'm missing something. How do users suppose to change the value of the "content editable" element?
|
@jgraham would you mind checking the feedback as received from @sadym-chromium? |
Unless I've mae a mistake with the spec (very possible, but you'll need to be more specific if so), it puts the cursor at the end (last editable point) of the element, which I believe was the intended behavior from the start.
By inserting text into it? I don't really understand the question, but in general if you want to do arbitary updates to a contenteditable element, then you need to use the actions API. |
| <li><p>Set the <a>active document</a>'s <a>selection</a> | ||
| to <var>range</var>. |
There was a problem hiding this comment.
I'm not sure if this means to select the whole element's content, or put just to put selection to the very end?
There was a problem hiding this comment.
It's supposed to be a collapsed range, whose start and end node is element and whose offset is child count i.e. a zero-length selection corresponding to a caret position at the end of the element.
Added the comment in the code. |
I believe the expected behaviour is:
Previously the spec was unconditionally focusing the target element (execpting some cases with file uploads), and therefore the letter of the spec was to never move the caret.
This change updates it to only focus the target if it's not already the active element, and then move the caret to the end.
Preview | Diff