Closed Bug 2069698 Opened 1 month ago Closed 29 days ago

Super stopped working as modifier when entering text

Categories

(Core :: DOM: UI Events & Focus Handling, defect)

Firefox 155
defect

Tracking

()

VERIFIED FIXED
157 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox-esr140 --- unaffected
firefox-esr153 --- unaffected
firefox155 --- wontfix
firefox156 + verified
firefox157 + verified

People

(Reporter: kamazee, Assigned: masayuki)

References

(Regression)

Details

(Keywords: inputmethod, regression)

Attachments

(3 files)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:155.0) Gecko/20100101 Firefox/155.0

Steps to reproduce:

Environment: Linux, native Wayland (about:support shows Window Protocol: wayland; Desktop Environment: Gnome)

Steps:

  1. Start Firefox with a fresh profile
  2. Open about:config and set ui.key.accelKey to 91 (Super / Win).
  3. Restart Firefox.
  4. Focus the address bar, type some text.
  5. Press Super+A, Super+C, Super+V.
  6. Press Super+T, Super+W

Actual results:

This is the behavior in 155:
Super+letter inserts the letter in the focused field.
Super+T / Super+W do not open/close tabs.

When not entering text (focus is somewhere on a page, not in the address bar or input/textarea), it works as expected (Super+C copies text into the clipboard, Super+T opens a new tab, Super+W closes the tab)

Expected results:

This is the behavior in 154:
Super+A / Super+C / Super+V: select all / copy / paste.
Super+T / Super+W: new tab / close tab.

The Bugbug bot thinks this bug should belong to the 'Core::Widget: Gtk' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Widget: Gtk
Product: Firefox → Core

FWIW, an AI-assisted investigation suggested that it's another regression of 2051354.

Here is the summary on the investigation:

  Root cause

  Between 154 and 155, Bug 2051354 reworked IMContextWrapper::OnCommitCompositionNative. In 154, if IME committed a character matching the key (no real composition), Firefox always fell back to normal keydown/keypress — so modifiers
  (including Super→Meta) stayed on the event and accel shortcuts worked.

  In 155, that fallback is gated by EditorMayHandleKeyPressEventAsTextInput(), which is false when Control/Alt/Meta are held:

   widget/gtk/nsGtkKeyUtils.cpp lines 1123-1127

  bool KeymapWrapper::EditorMayHandleKeyPressEventAsTextInput(
      guint aGdkModifierState) {
    const Modifiers modifiers = ComputeKeyModifiers(aGdkModifierState);
    return !(modifiers & (MODIFIER_CONTROL | MODIFIER_ALT | MODIFIER_META));
  }

  With ui.key.accelKey = 91, Super is Meta. So for Super+T / Super+W:

  1. IME (ibus/fcitx) filters the key and commits "t" / "w".
  2. EditorMayHandle… is false → no mGraphemeClusterFallbackToKeyEvent.
  3. Code falls through to DispatchCompositionCommitEvent → character is inserted.
  4. OnKeyEvent returns eHandled → chrome never sees a Meta key event → no new tab / close tab.
Attached file input.log —

Attaching the log (MOZ_LOG="IMEHandler:5,KeyboardHandler:5" firefox) of me focusing the Firefox window (address bar), typing "firefox.com" and the pressing Super+T, Super+W twice and then Super+A

Keywords: regression
Regressed by: 2051354

:masayuki, since you are the author of the regressor, bug 2051354, could you take a look? Also, could you set the severity field?

For more information, please visit BugBot documentation.

Flags: needinfo?(masayuki)

Oh, yeah, this is a really tricky case... DOM Meta modifier which is activated by Super, Hyper or Meta of Linux modifier does not change the character and we used the fallback path to dispatch eKeyDown event as is. However, currently, it's treated as a text input with a special feature of the IME.

Assignee: nobody → masayuki
Severity: -- → S2
Status: UNCONFIRMED → ASSIGNED
Component: Widget: Gtk → DOM: UI Events & Focus Handling
Ever confirmed: true
Flags: needinfo?(masayuki)
Keywords: inputmethod
OS: Unspecified → All
Hardware: Unspecified → All

Set release status flags based on info from the regressing bug 2051354

IME may send commit signal without the composing state when
user presses Super or something. Then, if the commit string is the
same as the character introduced by the key press, the user may want
to use a shortcut key or an access key. Therefore, we need to dispatch
eKeyDown instead of composition events or a content event with
Process eKeyDown since the global key handler needs to handle the
key event as a shortcut key.

The latest test build. Could you check whether this fix the bug in your environment too?

Flags: needinfo?(kamazee)
Pushed by masayuki@d-toybox.com: https://github.com/mozilla-firefox/firefox/commit/4075182cae4c https://hg.mozilla.org/integration/autoland/rev/c3bdf070cef7 Make `IMContextWrapper::OnCommitCompositionNative` use `eKeyDown` event if DOM `Ctrl`, `Alt` or `Meta` is pressed and the commit string is the same as the key r=m_kato
Status: ASSIGNED → RESOLVED
Closed: 29 days ago
Resolution: --- → FIXED
Target Milestone: --- → 157 Branch

The patch landed in nightly and beta is affected.
:masayuki, is this bug important enough to require an uplift?

For more information, please visit BugBot documentation.

Flags: needinfo?(masayuki)

:masayuki, thanks, I confirm that the nightly you sent the link to above works for me.

Flags: needinfo?(kamazee)

Makoto, can you please take care of uplifting this to beta, while Masayuki is away, if that also makes sense to you? Thank you.

Flags: needinfo?(masayuki) → needinfo?(m_kato)

firefox-beta Uplift Approval Request

  • User impact if declined/Reason for urgency: When using Firefox on Linux, there is some regressions after Firefox 155.
  • Some modifier keys for short cut are broken
  • If input method is XIM, user cannot input composing text.
  • Code covered by automated testing?: no
  • Fix verified in Nightly?: yes
  • Needs manual QE testing?: no
  • Steps to reproduce for manual QE testing:
  • Risk associated with taking this patch: low
  • Explanation of risk level: This issue is a regression by bug 2051354.

This fix to handle modifier key correctly after broken by bug 2051354. Also, when inputting a text as composing text, we set correct value to the UIEvent and dispatch correct composing events.

  • String changes made/needed?: No
  • Is Android affected?: no
Attachment #9637774 - Flags: approval-mozilla-beta?

IME may send commit signal without the composing state when
user presses Super or something. Then, if the commit string is the
same as the character introduced by the key press, the user may want
to use a shortcut key or an access key. Therefore, we need to dispatch
eKeyDown instead of composition events or a content event with
Process eKeyDown since the global key handler needs to handle the
key event as a shortcut key.

Original Revision: https://phabricator.services.mozilla.com/D323946

Flags: needinfo?(m_kato)
See Also: → 2069882
Attachment #9637774 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Duplicate of this bug: 2069748
QA Whiteboard: [qa-ver-needed-c157/b156]
Flags: qe-verify+
QA Contact: snegritas

Hello! I have tried to verify the fix in firefox 156.0b6 on Ubuntu 24.04 on wayland and after modifying the ui.key.accelKey to 91 the Super+a/c/v does not select the text or copy or paste. However the Super+t/w opens and closes a new tab. If the ui.key.accelKey is left by default the super+t/w does nothing.

Is this the expected outcome of the key press since i'm not sure since I can't fully reproduce the issue and can't verify the fix if the keypress for Super+a/c/v does not select all/copy/paste.

Have a nice day!

Flags: needinfo?(masayuki)

Well, the editing command shortcut keys are considered without ui.key.accelKey to align the shortcut keys to the native controls. Therefore, it may happen.

Flags: needinfo?(masayuki)

Hello! Thank you for the clarifications I rechecked with firefox 157.0a1(2026-09-10) and 156.0b6 the issue is fixed.

I will update the status and flags of this issue.

Have a nice day!

Status: RESOLVED → VERIFIED
QA Whiteboard: [qa-ver-needed-c157/b156] → [qa-ver-done-c157/b156]
Flags: qe-verify+
See Also: 2069882 →
See Also: → 2061489
Duplicate of this bug: 2072441
Duplicate of this bug: 2072555
No longer duplicate of this bug: 2072441
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: