Repository navigation
feat(rune-kit): submenu keyboard navigation and hover-open via MenuItem::on_submenu - #2204
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #1387. This is the remaining submenu work after #1964.
What changed
MenuItem::on_submenu(|s: &mut S, open| ..). It hands the menu the app's submenu open flag. Menus without it behave as before.on_close), Escape in the submenu leaves the parent menu and its scrim open.El::hover_delays(200 ms enter). Resting on a submenu row opens it; resting on any other row of the same menu, disabled rows included, closes it. The list of open-submenu closers is built once per menu and shared by its rows.Menu::on_close(Escape, a press outside) first closes every open controlled submenu, nested ones included, so the menu reopens with them closed.on_select/on_select_txdoes the same, except checkbox and radio items, which may keep the menu open.on_submenudocs, README and doctest say so.runecrate): newTx::key_direction(). In anEl::on_keyhandler it gives the focused element's layout direction (set inelement_key,Ltrelsewhere), so components can map Left and Right the way Rune's focus navigation does.on_submenucallbacks in one menu must take the same state type; this is documented.MenuItemparagraph incrates/rune-kit/README.md, plus a changelog fragment.Testing
crates/rune-kit/tests/integration/menu_submenu_nav.rs:on_close: Escape in the submenu closes only the submenu, the scrim stays, a second Escape closes the menu.cargo test -p rune-kit --test integration menu_: 23 passed.RUNE_ALLOW_NO_GPU=1 cargo test -p rune -p rune-mermaid -p rune-kit --features rune-kit/markdown,rune-kit/mermaid,rune/test-gpu-noop: all passed.cargo lint: no errors and no warnings on changed lines.cargo check -p rune --no-default-features --target wasm32-unknown-unknownandscripts/file-size.sh: pass.Closes #1387