In contenteditable, typing a Compose sequence after whitespace shifts it to before the whitespace
Categories
(Core :: DOM: Editor, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox-esr115 | --- | unaffected |
| firefox-esr128 | --- | unaffected |
| firefox137 | --- | disabled |
| firefox138 | --- | disabled |
| firefox139 | --- | fixed |
People
(Reporter: me, Assigned: masayuki)
References
(Regression)
Details
(Keywords: inputmethod, regression)
Attachments
(1 file)
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:139.0) Gecko/20100101 Firefox/139.0
Steps to reproduce:
- Prerequisite: have a Compose key set up.
- Open
data:text/html,<div contenteditable autofocus>A </div>. - Place the cursor at the end of the line, after the space.
- Type
Compose < "(for “).
Actual results:
During composition, you get an underlined · and then \<, in the correct location, as is traditional.
But after composition finishes, when the “ is placed, it (and the cursor) are shifted before the whitespace, so that you get A“|, rather than A “| (| indicating the caret position).
Expected results:
It should have stayed where it was.
This applies to any whitespace sequence at any position. Type a dozen spaces and put the cursor anywhere in it, and the compose sequence and cursor will be shifted to before them all.
Bisecting revealed bug 1951832 as the regressor, but it just enabled the editor.white_space_normalization.blink_compatible pref, so I don’t know if you count it or something else as the regressor.
Disabling editor.white_space_normalization.blink_compatible restores the old behaviour. I’ll keep it so for now, because it’s rather debilitating for my typing style!
| Reporter | ||
Comment 1•7 months ago
|
||
Minor fix of something in the description, where annoying Markdown quirks mangled it (I really should have used a non-breaking space the first time as a precaution against such stupidity, even though it’s kinda wrong then):
But after composition finishes, when the “ is placed, it (and the cursor) are shifted before the whitespace, so that you get
A“|, rather thanA “|(| indicating the caret position).
A“| should be A“| ; the space is still there, just after.
Updated•7 months ago
|
Updated•7 months ago
|
Comment 2•7 months ago
|
||
:masayuki, since you are the author of the regressor, bug 1951832, could you take a look? Also, could you set the severity field?
For more information, please visit BugBot documentation.
| Assignee | ||
Comment 3•7 months ago
|
||
The white-space should be invisible because of immediately before the end block boundary of the <div contenteditable>. Therefore, the white-space should be deleted at modifying end of the <div> for making the further processing simpler and such behavior is almost same as the other browsers (although it may be different whether the invisible white-space is deleted in each case). Additionally, anyway the white-space won't appear as the last white-space on the web apps after you save the content and load it.
So, from the editor module point of view, this is a WONTFIX bug for now even though the behavior looks completely odd.
| Assignee | ||
Comment 4•7 months ago
|
||
In other words, this is unrealistic case in usual web apps because the invisible white-spaces should be trimmed by the web app when the content gets loaded to avoid odd behavior on any browsers.
| Reporter | ||
Comment 5•7 months ago
|
||
No, this happens at any place in the contenteditable: the compose sequence and final cursor position are shifted to the start of any sequence of spaces. This is what makes it really bad for people like me who type curly quotes.
Type He said “hello”. using a Compose sequence for the curly quotes, and you get He said“hello”.| instead of He said “hello”.|
Type Alpha Beta, place your cursor in the middle of the spaces, and type Compose o o, and instead of Alpha °| Beta, you get Alpha°| Beta.
(Aside: ugh, what is this Markdown engine doing, collapsing multiple spaces inside backticks!?)
| Assignee | ||
Comment 6•7 months ago
|
||
So, do you say it's reproducible with data:text/html,<div contenteditable autofocus>A%A0</div>?
| Reporter | ||
Comment 7•7 months ago
|
||
Yes. Any spaces, including non-breaking ones, in any position.
| Assignee | ||
Comment 8•7 months ago
|
||
Okay I reproduce this on Ubuntu.
| Assignee | ||
Comment 9•7 months ago
|
||
Oh, this is really tricky behavior of the IME.
When I type the last character, the composition ended with empty string temporarily. Then, keydown is fired again and it introduces the composed character as usual typed text.
| Assignee | ||
Updated•7 months ago
|
| Assignee | ||
Comment 10•7 months ago
|
||
When inserting text or deleting text is for updating composition string,
InsertTextWithTransaction() does not suggest caret position because in the
most cases, CompositionTransaction updating Selection properly. However,
if it's deleting existing composition (i.e., replacing the composition with
empty string), HTMLEditor::HandleInsertText() doesn't use
CompositionTransaction to update composition. Instead, it uses the suggested
caret position from InsertTextWithTransaction() even though it's always unset.
Therefore, if the composition string follows some collapsible white-spaces and
they are replaced, Selection is automatically moved to the start position of
the replaced range and HTMLEditor::HandleInsertText() does not maintain the
caret position.
Therefore, this patch make it collapse Selection to end of the inserted text
where the composition string was.
Comment 11•7 months ago
|
||
Comment 12•7 months ago
|
||
| bugherder | ||
Updated•7 months ago
|
Description
•