`TextEditor` and `HTMLEditor` should handle `keypress` events with `.key` value instead of `.charCode` value (in early beta builds and nightly builds)
Categories
(Core :: DOM: Editor, defect, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox118 | --- | fixed |
People
(Reporter: masayuki, Assigned: masayuki)
References
(Blocks 1 open bug)
Details
Attachments
(2 files)
Currently, both TextEditor
and HTMLEditor
handles keypress
events with their .charCode
value. This may cause dispatching beforeinput
and input
events with one surrogate value data
attribute.
Therefore, they should handle it once per a surrogate pair, which is stored in .key
value.
Assignee | ||
Comment 1•1 year ago
|
||
Ah, in my understanding TextEventDispatcher
sets .key
value for high-surrogate keypress
to the surrogate pair, and one for low-surrogate keypress
to empty string. However, it does not do so. Therefore, I need to change TextEventDispatcher
too.
Assignee | ||
Comment 2•1 year ago
|
||
A lone surrogate should not appear in DOMString
at least when the attribute
values of events.
TextEventDispatcher
does not handle surrogate pairs correctly. It should not
split surrogate pairs when it sets KeyboardEvent.key
value for avoiding the
problem in some DOM API wrappers, e.g., Rust-running-as-wasm.
Additionally, TextEditor
and HTMLEditor
should handle keypress
events
with .key
value if it's available and should not accept a surrogate because
InputEvent.data
should not be a surrogate.
Therefore, this patch makes TextEventDispatcher
sets a surrogate pair to
.key
value if the keypress
event is for a high-surrogate and makes the
.key
value empty if the keypress
event is for a low-surrogate.
(Note that there is a spec issue whether .charCode
for keypress
should have
a Unicode point or a byte of UTF-16, see https://github.com/w3c/uievents/issues/346)
Finally, this patch makes TextEditor
and HTMLEditor
handles keypress
events with .key
value unless .charCode
is neither 0
nor a surrogate but
.key
value is empty (this is required for some edge cases like input from
barcode scanner).
Assignee | ||
Comment 3•1 year ago
|
||
This includes source file and binary (installer) of Emoji keyboard layout which is created with Microsoft Keyboard Layout Creator (MSKLC). This types one key stroke as a face mark of Emoji, and the keyboard layout is installed as en-US language's layout.
Assignee | ||
Updated•1 year ago
|
Updated•1 year ago
|
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/1e0ec5506207 Make typing surrogate pair behavior switchable with prefs r=m_kato,smaug
Assignee | ||
Updated•11 months ago
|
Comment 5•11 months ago
|
||
bugherder |
Description
•