Caret doesn't move to beginning or ending of div w/ contenteditable = true with repeated left / right arrow keys
Categories
(Core :: DOM: Selection, defect)
Tracking
()
People
(Reporter: rpaplin, Assigned: peterv)
References
Details
Attachments
(3 files)
3.15 KB,
text/html
|
Details | |
1.52 KB,
patch
|
Details | Diff | Splinter Review | |
2.54 KB,
text/html
|
Details |
Reporter | ||
Comment 1•17 years ago
|
||
Comment 2•17 years ago
|
||
Updated•17 years ago
|
Assignee | ||
Comment 3•17 years ago
|
||
Reporter | ||
Updated•16 years ago
|
Updated•16 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Comment 4•4 years ago
•
|
||
I've been interested in trying to fix this bug, or at least to get Mozilla Firefox's behavior consistent with Google Chrome's. I tried to write this under web-platform tests, but I couldn't make the test perform the keystrokes in Chrome. That said, opening this HTML attachment in Firefox and in Chrome, and then following the keystrokes, will give an idea, I hope.
I think the nsFrameSelection code is similar to the original code from 13 years ago, particularly in code comments.
Interestingly enough, when the "x" keystroke happens, Google Chrome inserts a new text node under the <div id="editor-inner"> element. Firefox changes the "bar" to "barx".
If there is a way to write this test for web-platform tests, I'd love to see it done.
Comment 5•4 years ago
|
||
The test expects odd result to me. When ArrowLeft
is pressed in the {middleText, 0}
, I feel that caret should be put on the end of the previous editable text node.
And you can write the test as WPT like: https://searchfox.org/mozilla-central/source/testing/web-platform/tests/editing/other/typing-around-link-element-at-collapsed-selection.tentative.html
Comment 6•4 years ago
|
||
(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900)(Got a cold, working slower) from comment #5)
The test expects odd result to me. When
ArrowLeft
is pressed in the{middleText, 0}
, I feel that caret should be put on the end of the previous editable text node.
I think I see a potential trouble spot with that argument, but I'm not sure. (Far more likely is that I don't know what I'm talking about in this next example.) Imagine
<div contenteditable="true">
<span>before</span>
<div>
<div>
<div>
Hello
</div>
</div>
</div>
<span>after</span>
</div>
Rendered, the whitespace nodes before and after each <div> and </div> are, well, whitespace - not visible to the user. So from the start of "Hello", to get to the word "before" might take three left keystrokes, for reasons that would be not obvious to the end-user.
I'm not saying you're wrong. I'm just providing an example of funny behavior that might result in if I don't fully understand what you're suggesting. (But that might be the responsibility of the webpage author.)
And you can write the test as WPT like: https://searchfox.org/mozilla-central/source/testing/web-platform/tests/editing/other/typing-around-link-element-at-collapsed-selection.tentative.html
... which fails on all but one test because testdriver.action_sequence returns a Promise.reject(). I appreciate the reference, but I'd need a fix for that before I could use it.
Updated•2 years ago
|
Description
•