For me at least, this issue happens because Firefox gets "poisoned" with a future timestamp which can be created by Nautilus on Drag&Drop due to a bug in GTK 4.
This leads Firefox to send _NET_ACTIVE_WINDOW with a future timestamp. When Mutter gets a future timestamp, it does not currently reject it for this event (see meta_display_timestamp_too_old(), which contains a FIXME comment suggesting that future timestamps SHOULD be rejected). So it accepts the message, raises the window and sends SetInputFocus to the X server with the same timestamp. However, the X server rejects this focus request due to the future timestamp, which leads to the observed situation where the window is drawn focused while keyboard input stays elsewhere. See https://bugzilla.mozilla.org/show_bug.cgi?id=2053470#c3 for a more complete write-up. ** Bug watch added: Mozilla Bugzilla #2053470 https://bugzilla.mozilla.org/show_bug.cgi?id=2053470 -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2107678 Title: Wrong keyboard focus after switching window in Xorg To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/mutter/+bug/2107678/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
