Skip to content

Have KHamburgerMenu's shortcut open a menu

For accessibility we need KHamburgerMenu to open a menu no matter which state the application is in. Pressing the shortcut will:

  • trigger/open a hamburger button if one is available
  • otherwise trigger/open the menu bar if that one is available
  • otherwise open the hamburger menu at the mouse cursor position

2023-09-16_14-39-09

Test plan

  1. Start any application using KHamburgerMenu.
  2. Assign a shortcut to "Open Menu" i.e. KHamburgerMenu.
  3. Use the shortcut under various circumstances.

Technical Details

Keyboard shortcuts don't get triggered if the connected action is set to invisible. Before this commit, KHamburgerMenu set itself invisible only to hide the hamburger button whenever the menu bar is visible. This commit changes this so the KHamburgerMenu action is always visible. Therefore the keyboard shortcut always works. Instead, the buttons belonging to the KHamburgerMenu action are hidden whenever we would have hidden the action.

A new test is added for the new behaviour. The previous tests are adapted to work even though the logic for visually hiding the hamburger buttons has changed.

Outlook

The next step is actually setting a standard keyboard shortcut by default for KHamburgerMenu. That one is supposed to be F10 as explained in the eMail I sent: https://mail.kde.org/pipermail/kde-devel/2023-September/002017.html

Merge request reports