Closed Bug 1615867 Opened 5 years ago Closed 5 years ago

Switching input method blurs the input

Categories

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

Desktop
Linux
defect

Tracking

()

RESOLVED DUPLICATE of bug 1552445

People

(Reporter: xidorn, Unassigned)

References

Details

(Keywords: regression)

Attachments

(1 file)

Attached file testcase

Steps to reproduce:

  1. open the attached testcase
  2. focus the input box in the page
  3. switch the input method via the shortcut (Super + space as default for me)
  4. observe the log under the input box which records focus and blur events

Expected result:
there is no extra blur / focus events when switching input method

Actual result:
there are two blur-focus event pairs appear there

I tried to change to a different shortcut, specifically Ctrl + space, and the issue is still there. Also if I choose the input method from the input method menu on the system tray, the same thing would happen as well.

I tested Chromium, and there is no such issue there.

This is observable, especially that on certain websites, once you blur an input, it wouldn't gain focus back automatically, which is annoying.

I'm not sure whether it should be an issue in DOM or in the widget.

Oh, and I'm using Ubuntu 19.04 with GNOME and iBus.

Doesn't repro for me on Ubuntu 18.04.

Doesn't repro for me on Ubuntu 19.10 (tried keyboard layouts only).

(In reply to Xidorn Quan [:xidorn] UTC+11 from comment #1)

Oh, and I'm using Ubuntu 19.04 with GNOME and iBus.

Isn't 19.04 out of support?

OK. I can repro on Ubuntu 19.10 if at least one of the participants in the switch is indeed an IBus IME and not a plain keyboard layout.

masayuki, do you know why this happens? (This is a regression relative to Ubuntu 18.04.)

Flags: needinfo?(masayuki)
Priority: -- → P2

Yeah, it's 19.10, sorry...

According to the log of nsGtkIMModuleWidgets:5, IMContextWrapper::OnBlurWindow() and IMContextWrapper::OnFocusWindow() are called.
https://searchfox.org/mozilla-central/rev/96f1457323cc598a36f5701f8e67aedaf97acfcf/widget/gtk/nsWindow.cpp#1649,1726
https://searchfox.org/mozilla-central/rev/96f1457323cc598a36f5701f8e67aedaf97acfcf/widget/gtk/nsWindow.cpp#3160,3188
This means GTK widget dispatches active and deactive events.

karlt, enndeakin: Do you know something about window level focus issue on Linux?

Flags: needinfo?(masayuki)
Flags: needinfo?(karlt)
Flags: needinfo?(enndeakin)

If the shortcut is a global shortcut handled by the window manager, then a temporary loss of focus is expected so that the window manager can receive the keyboard events for the shortcut.

https://searchfox.org/mozilla-central/search?q=GDK_WINDOW_STATE_FOCUSED is not affected by this. Perhaps Chromium is avoiding the problem by using this.

If the shortcut is handled by the input method itself, then the situation is different, but I'm not familiar with how input methods affect focus.

Flags: needinfo?(karlt)

(In reply to Karl Tomlinson (:karlt) from comment #8)

If the shortcut is a global shortcut handled by the window manager, then a temporary loss of focus is expected so that the window manager can receive the keyboard events for the shortcut.

I tested the super-space shortcut, which at least looks like it's a Gnome Shell -level thing. Why does the temporary loss of focus not occur on Ubuntu 18.04 when switching between IMEs or on Ubuntu 19.10 when switching between keyboard layouts? Gnome Shell handles super-space in those cases, too.

Flags: needinfo?(karlt)

(In reply to Henri Sivonen (:hsivonen) from comment #9)

(In reply to Karl Tomlinson (:karlt) from comment #8)

If the shortcut is a global shortcut handled by the window manager, then a temporary loss of focus is expected so that the window manager can receive the keyboard events for the shortcut.

I tested the super-space shortcut, which at least looks like it's a Gnome Shell -level thing. Why does the temporary loss of focus not occur on Ubuntu 18.04 when switching between IMEs or on Ubuntu 19.10 when switching between keyboard layouts? Gnome Shell handles super-space in those cases, too.

I interpreted my results incorrectly. The cases where I didn't see the problem (18.04 with IME and 19.10 with keyboard layouts only) were in Wayland sessions. The case where I saw the problem was in an X session.

This is a Wayland vs. X thing. The problem does not occur on 19.10 between IMEs in a Wayland session.

Flags: needinfo?(karlt)
See Also: → 1552445

Bugbug thinks this bug is a regression, but please revert this change in case of error.

Keywords: regression
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
Flags: needinfo?(enndeakin)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: