Skip to content

Fix menu keyboard toggle for open submenus#7957

Open
fjkorf wants to merge 4 commits intoemilk:mainfrom
fjkorf:fix-menu-keyboard-toggle-for-open-submenus
Open

Fix menu keyboard toggle for open submenus#7957
fjkorf wants to merge 4 commits intoemilk:mainfrom
fjkorf:fix-menu-keyboard-toggle-for-open-submenus

Conversation

@fjkorf
Copy link

@fjkorf fjkorf commented Mar 5, 2026

Summary
This PR fixes submenu keyboard parity: pressing Enter/Space on an already-open submenu button now collapses that submenu (matching top-level menu button behavior).

What changed
Updated submenu interaction logic to distinguish pointer primary clicks from keyboard/accessibility-triggered clicks.
Kept pointer/touch behavior unchanged (submenu button clicks still don’t auto-close submenu).
Added regression tests for:
keyboard open of nested submenu,
keyboard close (second Enter) of nested submenu,
pointer clicks on submenu button keeping submenu open.

Validation
cargo test -p egui_kittest --test regression_tests

Breaking changes
None. Behavior change is limited to keyboard/accessibility activation of already-open submenu buttons.

@fjkorf fjkorf requested a review from lucasmerlin as a code owner March 5, 2026 05:39
@github-actions
Copy link

github-actions bot commented Mar 5, 2026

Preview available at https://egui-pr-preview.github.io/pr/7957-fix-menu-keyboard-toggle-for-open-submenus
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

View snapshot changes at kitdiff

Copy link
Collaborator

@lucasmerlin lucasmerlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@lucasmerlin lucasmerlin added bug Something is broken egui labels Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something is broken egui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to close submenus with keyboard

2 participants