[Linux] first character in web.whatsapp.com is deleted if it's accented.
Categories
(Core :: DOM: UI Events & Focus Handling, defect)
Tracking
()
People
(Reporter: emilio, Unassigned)
References
(Depends on 1 open bug)
Details
(Keywords: inputmethod)
Attachments
(3 files)
Apparently it works on Ubuntu somehow (which is why bug 1799384 was closed as WFM), but I can reproduce on Arch Linux.
Somebody else reported it on Matrix and there's more context in https://github.com/webcompat/web-bugs/issues/111506. It seems something weird going on with IME, but only on that page...
Masayuki, asking you for context, have you seen something this before? Do you know where to look at?
Reporter | ||
Comment 1•4 months ago
|
||
Reporter | ||
Comment 2•4 months ago
|
||
So for that page, when composing á I get:
keydown { target: div, key: "Process", charCode: 0, keyCode: 229 }
keydown { target: div, key: "Process", charCode: 0, keyCode: 229 }
beforeinput { target: div, isTrusted: true, isComposing: true, inputType: "insertCompositionText", data: "·", … }
input { target: div, isTrusted: true, isComposing: true, inputType: "insertCompositionText", data: "·", … }
keydown { target: div, key: "Process", charCode: 0, keyCode: 229 }
beforeinput { target: div, isTrusted: true, isComposing: true, inputType: "insertCompositionText", data: "'", … }
input { target: div, isTrusted: true, isComposing: true, inputType: "insertCompositionText", data: "'", … }
keyup { target: div, key: "Process", charCode: 0, keyCode: 229 }
keyup { target: div, key: "Process", charCode: 0, keyCode: 229 }
keydown { target: div, key: "Process", charCode: 0, keyCode: 229 }
beforeinput { target: div, isTrusted: true, isComposing: true, inputType: "insertCompositionText", data: "", … }
input { target: div, isTrusted: true, isComposing: true, inputType: "insertCompositionText", data: "", … }
keydown { target: div, key: "Process", charCode: 0, keyCode: 229 }
input { target: div, isTrusted: true, isComposing: false, inputType: "insertCompositionText", data: "", … }
keydown { target: div, key: "Process", charCode: 0, keyCode: 229 }
beforeinput { target: div, isTrusted: true, isComposing: false, inputType: "insertText", data: "á", … }
input { target: div, isTrusted: true, isComposing: false, inputType: "insertText", data: "á", … }
keyup { target: div, key: "a", charCode: 0, keyCode: 65 }
One thing that stands out is that:
- There are multiple keydown events for my compose key (right alt in this case). Not sure what they're mapped to.
- There's an
input
event without abeforeinput
event for an empty string right before getting the composed character:
input { target: div, isTrusted: true, isComposing: false, inputType: "insertCompositionText", data: "", … }
Masayuki, do any of those seem unexpected? Do you know what's going on an where the fix should be if not?
Reporter | ||
Comment 3•4 months ago
|
||
FWIW, chrome events are quite different (but also why composing they don't show the underlined dot / char etc):
keydown KeyboardEvent {isTrusted: true, key: 'Process', code: 'AltRight', location: 2, ctrlKey: false, …}
keydown KeyboardEvent {isTrusted: true, key: 'Process', code: 'Quote', location: 0, ctrlKey: false, …}
keyup KeyboardEvent {isTrusted: true, key: 'Compose', code: 'AltRight', location: 2, ctrlKey: false, …}
keyup KeyboardEvent {isTrusted: true, key: "'", code: 'Quote', location: 0, ctrlKey: false, …}
keydown KeyboardEvent {isTrusted: true, key: 'Process', code: 'KeyA', location: 0, ctrlKey: false, …}
beforeinput InputEvent {isTrusted: true, data: 'á', isComposing: false, inputType: 'insertText', dataTransfer: null, …}i
input InputEvent {isTrusted: true, data: 'á', isComposing: false, inputType: 'insertText', dataTransfer: null, …}
keyup KeyboardEvent {isTrusted: true, key: 'a', code: 'KeyA', location: 0, ctrlKey: false, …}
The redundant empty string composition may make the editor confused. Could you attach a log file getting with MOZ_LOG=IMEHandler:4,sync
?
Reporter | ||
Comment 5•4 months ago
|
||
Reporter | ||
Comment 6•4 months ago
|
||
Thank you, Emilio!
I/IMEHandler >>>>>>>>>>>>>>>>
I/IMEHandler 0x766af9bf7bd0 OnKeyEvent(aCaller=0x766b0e91bd00, aEvent(0x766ae553c980): { type=GDK_KEY_PRESS, keyval=a, unicode=0x61, state=, time=6283442, hardware_keycode=38, group=0 }, aKeyboardEventWasDispatched=false)
I/IMEHandler 0x766af9bf7bd0 OnKeyEvent(), mMaybeInDeadKeySequence=false, mCompositionState=CompositionChangeEventDispatched, current context=766af915a640, active context=766af915a640, mIMContextID=Wayland, mIsIMInAsyncKeyHandlingMode=false
I/IMEHandler 0x766af9bf7bd0 OnChangeCompositionNative(aContext=0x766af915a640), mComposingContext=0x766af915a640
I/IMEHandler 0x766af9bf7bd0 GetCompositionString(aContext=0x766af915a640), aCompositionString=""
I/IMEHandler 0x766af9bf7bd0 DispatchCompositionChangeEvent(aContext=0x766af915a640)
I/IMEHandler 0x766af9bf7bd0 MaybeDispatchKeyEventAsProcessedByIME(aFollowingEvent=eCompositionChange), dispatch eKeyDown processing event: { type=GDK_KEY_PRESS, keyval=a, unicode=0x61, state=, time=6283442, hardware_keycode=38, group=0 }
I/IMEHandler 0x766af9bf7bd0 MaybeDispatchKeyEventAsProcessedByIME(), keydown or keyup event is dispatched
I/IMEHandler 0x766af9bf7bd0 CreateTextRangeArray(aContext=0x766af915a640, aCompositionString="" (Length()=0))
I/IMEHandler 0x766af9bf7bd0 OnEndCompositionNative(aContext=0x766af915a640), mComposingContext=0x766af915a640
I/IMEHandler 0x766af9bf7bd0 DispatchCompositionCommitEvent(aContext=0x766af915a640, aCommitString=0x0, (""))
I/IMEHandler 0x766af9bf7bd0 MaybeDispatchKeyEventAsProcessedByIME(aFollowingEvent=eCompositionCommitAsIs), dispatch eKeyDown processing event: { type=GDK_KEY_PRESS, keyval=a, unicode=0x61, state=, time=6283442, hardware_keycode=38, group=0 }
I/IMEHandler 0x766af9bf7bd0 MaybeDispatchKeyEventAsProcessedByIME(), keydown or keyup event is dispatched
I/IMEHandler 0x766af9bf7bd0 OnCommitCompositionNative(aContext=0x766af915a640), current context=0x766af915a640, active context=0x766af915a640, commitString="á", mProcessingKeyEvent=0x766ae553c980, IsComposingOn(aContext)=false
I/IMEHandler 0x766af9bf7bd0 DispatchCompositionCommitEvent(aContext=0x766af915a640, aCommitString=0x7fff9e30fda0, ("á"))
I/IMEHandler 0x766af9bf7bd0 MaybeDispatchKeyEventAsProcessedByIME(aFollowingEvent=eContentCommandInsertText), dispatch eKeyDown processing event: { type=GDK_KEY_PRESS, keyval=a, unicode=0x61, state=, time=6283442, hardware_keycode=38, group=0 }
I/IMEHandler 0x766af9bf7bd0 MaybeDispatchKeyEventAsProcessedByIME(), keydown or keyup event is dispatched
I/IMEHandler 0x766af9bf7bd0 DispatchCompositionCommitEvent(), mContentSelection={ HasRange()=false }
I/IMEHandler 0x766af9bf7bd0 OnRetrieveSurroundingNative(aContext=0x766af915a640), current context=0x766af915a640
I/IMEHandler 0x766af9bf7bd0 GetCurrentParagraph(), mCompositionState=NotComposing
D/IMEHandler 0x766af9bf7bd0 GetCurrentParagraph(), selOffset=2, selLength=0
D/IMEHandler 0x766af9bf7bd0 GetCurrentParagraph(), succeeded, aText=', aText.Length()=2, aCursorPos=1
D/IMEHandler 0x766af9bf7bd0 OnKeyEvent(), succeeded, filterThisEvent=true (isFiltered=true, mFallbackToKeyEvent=false, probablyHandledAsynchronously=false, maybeHandledAsynchronously=false), mPostingKeyEvents.Length()=0, mCompositionState=NotComposing, mMaybeInDeadKeySequence=false, mKeyboardEventWasDispatched=true, mKeyboardEventWasConsumed=false
I/IMEHandler <<<<<<<<<<<<<<<<
It seems that once committing with empty string is a hack for apps which are not familiar with IME composition. Fortunately, all things happens during a call of gtk_im_context_filter_keypress()
. So I think that we need to redesign the handling of them to put each action into a queue and flush them with ignoring the redundant native events. I think that I should work on this after fixing bug 1679108 in H1.
Additionally, looks like we return wrong text for the last request from IME.
I wonder, the last composed character insertion causes only beforeinput
event. If the web apps still depend on textInput
, that might be the root cause. Emilio, do you reproduce the bug even if you switch intl.ime.use_composition_events_for_insert_text
to true
? (The pref is being removed in bug 1841194, though.)
Oh, thanks. I'll keep thinking what's going on...
Description
•