Bug 482058 - Keyboard Layout widget steals focus
Summary: Keyboard Layout widget steals focus
Status: RESOLVED DUPLICATE of bug 479084
Alias: None
Product: plasmashell
Classification: Plasma
Component: Keyboard Layout (show other bugs)
Version: 6.0.0
Platform: Arch Linux Linux
: NOR minor
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: qt6
Depends on:
Blocks:
 
Reported: 2024-02-29 16:31 UTC by Hanabishi
Modified: 2024-03-19 18:50 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
keyboardlayout-focus.patch (473 bytes, patch)
2024-02-29 16:31 UTC, Hanabishi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hanabishi 2024-02-29 16:31:56 UTC
Created attachment 166205 [details]
keyboardlayout-focus.patch

SUMMARY
When Keyboard Layout widget is on the panel, it steals focus from the current app on layout change. Both by hotkey or mouse click.

STEPS TO REPRODUCE
1. Add "Keyboard Layout" widget on the panel.
2. Focus a text field in any app.
3. Switch layout.

OBSERVED RESULT
Widget (panel) steals focus from the app.

EXPECTED RESULT
Focues should remain in the current app / text field.

SOFTWARE/OS VERSIONS
Linux: Arch Linux
KDE Plasma Version: 6.0.0
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2

ADDITIONAL INFORMATION
I actually managed to workaround it by editing 'main.qml' file of the applet. Removing 'onLayoutChanged' function fixes the issue. The patch is attached.
I don't know why this function exists and why such widget ever need to "activate" itself on layout change, but for me it works just fine without it.
Comment 1 Andrey 2024-02-29 17:01:55 UTC
Thanks, is it regression since Plasma 5?

About the onLayoutChanged(), it's used for "push in" effect for the applet to make the layout change more noticeable.
Either way, we need to find out if it's a regression or not.
Comment 2 Hanabishi 2024-02-29 17:09:29 UTC
(In reply to Andrey from comment #1)
> Thanks, is it regression since Plasma 5?

Yeah, it was fine in Plasma 5. So it is kind of a regression.

Although, as I see from the commit history, the function was there for years. So it is not a direct regression in the applet.
Comment 3 Andrey 2024-02-29 17:18:52 UTC
OK, so it's more fundamental problem then which can explode in many places.
Not sure if it's KWin or some Qt/Framework guilty.
Comment 4 Andrey 2024-02-29 17:27:37 UTC
I recall someone reported about OSD steal focus, it might be the same problem.
Comment 5 Hanabishi 2024-02-29 17:39:27 UTC
I also suspected OSD initially, but disabling it changed nothing. And focus visibly appears on the panel, so I narrowed it down to the applet itself.
Btw, the problem only appears on a standalone widget. It does not do that as a System Tray built-in.

Forgot to mention, I reproduce it in Wayland session, not tested in X.
Comment 6 Andrey 2024-02-29 17:43:17 UTC
Could you check if volume OSD produces the same effect?
Maybe test with standalone widget too, if possible.
Comment 7 Hanabishi 2024-02-29 17:58:44 UTC
I don't see any issues with the volume widget or volume OSD.
Comment 8 Nate Graham 2024-03-01 20:41:42 UTC
Can trivially reproduce the issue. It's a regression in Plasma 6 caused by Panel focus changes. I suspect it'll end being a similar issue to Bug 479084.
Comment 9 Yehor 2024-03-06 23:02:53 UTC
Can confirm this issue, I tried to disable OSD but it still happens. The attached patch with removing onLayoutChanged did help in resolving it. 

Although Wayland and X11 seem to behave differently with this function present. On Wayland I clearly see that focus gets taken away on layout switch, but on X11 everything works fine at first but after some time I can't focus in any window anymore and focus disappears right after I click on a window, maybe it happens after I switch layout several times or open several windows at once, couldn't pinpoint the exact moment.

SOFTWARE/OS VERSIONS
Linux: Endeavour OS
KDE Plasma Version: 6.0.1
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Kernel: 6.7.8-arch1-1 (64-bit)
Graphics Platform: Wayland and X11
Comment 10 Nate Graham 2024-03-08 22:46:55 UTC

*** This bug has been marked as a duplicate of bug 482653 ***
Comment 11 Hanabishi 2024-03-09 02:04:32 UTC
Why closed as duplicate? This report was created way earlier. Shouldn't it be vice versa?
Comment 12 Nate Graham 2024-03-10 03:03:28 UTC
Probably should be, yeah, but what's done is done, sorry.
Comment 13 Nate Graham 2024-03-19 18:50:51 UTC

*** This bug has been marked as a duplicate of bug 479084 ***