Skip to content

Open context menu on Shift+F10

Requires kconfig!251 (merged).

Users who can't use a mouse pointer or other pointing device rely on the keyboard to open context menus. However, many keyboards these days do not have a Menu key. Therefore there is no way to open context menus by only using a keyboard. This is a big issue for accessibility.

Everyone else has already decided that context menus should be triggered by Shift+F10. This is already recommended by the Web Accessibility Initiative, Microsoft, and implemented in Chrome/ium and Firefox.

This commit posts a QContextMenuEvent whenever a Shift+F10 key event makes it to KMainWindow. This only happens if this key combination isn't already consumed before that for example because it is assigned to an action in application code.

Some actions do not react correctly to QContextMenuEvents because they might be hard-coded to only react to right-clicks or Menu key presses specifically. Those will need to be adapted later for this to work as expected everywhere.

This commit will have no effect on widgets which aren't children of the main window.

Only tested in Dolphin. Be aware that if a widget has code that assumes that context menus are only ever triggered by right-click, they might also have code that makes the context menu appear at the mouse pointer location even though the posted QContextMenuEvent contains the information that it was triggered by keyboard.

Edited by Felix Ernst

Merge request reports