Bug 465385 - With Wayland menu keyboard navigation (left/right keys) closes all menu
Summary: With Wayland menu keyboard navigation (left/right keys) closes all menu
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (other bugs)
Version First Reported In: 5.26.90
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-02-06 18:12 UTC by Mykola Krachkovsky
Modified: 2024-10-02 10:55 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 6.2.0
Sentry Crash Report:


Attachments
Opened submenu (257.19 KB, image/png)
2023-02-09 09:42 UTC, Mykola Krachkovsky
Details
Window menu (100.86 KB, image/png)
2023-02-09 09:46 UTC, Mykola Krachkovsky
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mykola Krachkovsky 2023-02-06 18:12:25 UTC
SUMMARY
When open menu (window menu, context or hamburger) when pressing left or right key whole menu is close, instead of moving to previous/next menu (in window menu) or returning to upper level menu (submenu in context/hamburger).

STEPS TO REPRODUCE
For context/hamburger
1. Open context/hamburger menu.
2. Navigate to submenu (keyboard or mouse — doesn't matter at this step).
3. Press Left key to return to upper menu.

For window menu
1. Open window menu (with Alt+letter or using a mouse).
2. Press Left or Right key to go to previous or next item.

OBSERVED RESULT
Whole menu is closed.

EXPECTED RESULT
Only submenu should be closed, or next/previous item selected.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: openSUSE Tumbleweed 20230204
KDE Plasma Version: 5.26.90
KDE Frameworks Version: 5.102.0
Qt Version: 5.15.8+kde160

ADDITIONAL INFORMATION
In Qt Creator (build with Qt6) context menu works fine. Maybe it's a Qt bug.
Comment 1 Vlad Zahorodnii 2023-02-07 08:20:49 UTC
> Open context/hamburger menu

Can you be more specific please?
Comment 2 Nate Graham 2023-02-07 18:51:13 UTC
It's about Qt sub-menu keyboard navigation. when navigating to a sub-menu, pressing the left arrow key closes the whole menu structure, not just the sub-menu. I can confirm this in KDE apps with native menus.
Comment 3 Mykola Krachkovsky 2023-02-09 09:40:02 UTC
(In reply to Vlad Zahorodnii from comment #1)
> > Open context/hamburger menu
> 
> Can you be more specific please?

Basically any context/hamburger menu in Qt5 Widget application, e.g. Dolphin hamburger&context menu menu, Falkon context menu, Krusader bookmarks menu, etc.

As a test you can open Dolphin hamburger menu, then with keyboard navigate to Create (New?) submenu, and then press left go up level. And whole menu is closed not just submenu. I'll add a screenshot.
Comment 4 Mykola Krachkovsky 2023-02-09 09:42:37 UTC
Created attachment 156094 [details]
Opened submenu

If at this point you'll push left button to go back to upper menu, whole menu will be closed, not just submenu.
Comment 5 Mykola Krachkovsky 2023-02-09 09:46:00 UTC
Created attachment 156095 [details]
Window menu

Also with regular menu, pressing Left or Right also closes menu instead of moving to previous/next item.
Comment 6 Vlad Zahorodnii 2023-02-10 08:54:20 UTC
(In reply to Nate Graham from comment #2)
> It's about Qt sub-menu keyboard navigation. when navigating to a sub-menu,
> pressing the left arrow key closes the whole menu structure, not just the
> sub-menu. I can confirm this in KDE apps with native menus.

This sounds like a client bug (qmenu or qtwayland) not the compositor bug.
Comment 7 Vlad Zahorodnii 2024-10-01 11:21:25 UTC
(In reply to Vlad Zahorodnii from comment #6)
> This sounds like a client bug (qmenu or qtwayland) not the compositor bug.

I might have been wrong with this assessment, I can reproduce the issue, and I think I know what's causing it.
Comment 8 Bug Janitor Service 2024-10-01 12:16:48 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/6544
Comment 9 Vlad Zahorodnii 2024-10-01 19:03:34 UTC
Git commit 19c467147a06e12e511f7dfd9b89c6c73c50834b by Vlad Zahorodnii.
Committed on 01/10/2024 at 18:52.
Pushed by vladz into branch 'master'.

Move keyboard focus to grabbing popup immediately

It seems that QMenu expects to receive keyboard focus when it's mapped,
otherwise keyboard input breaks when using pointer input. In either case,
kwin should move keyboard focus immediately rather than do it on demand.

M  +2    -0    src/popup_input_filter.cpp

https://invent.kde.org/plasma/kwin/-/commit/19c467147a06e12e511f7dfd9b89c6c73c50834b
Comment 10 Vlad Zahorodnii 2024-10-02 10:34:00 UTC
Git commit aa01ae5a95de4f6639b103e9f706577d5393ec54 by Vlad Zahorodnii.
Committed on 02/10/2024 at 10:24.
Pushed by vladz into branch 'Plasma/6.2'.

Move keyboard focus to grabbing popup immediately

It seems that QMenu expects to receive keyboard focus when it's mapped,
otherwise keyboard input breaks when using pointer input. In either case,
kwin should move keyboard focus immediately rather than do it on demand.
(cherry picked from commit 19c467147a06e12e511f7dfd9b89c6c73c50834b)

M  +2    -0    src/popup_input_filter.cpp

https://invent.kde.org/plasma/kwin/-/commit/aa01ae5a95de4f6639b103e9f706577d5393ec54