Expand description
Keyboard interaction for popup widgets: <dropdown> (combobox) and
<menu> panels. Matches the Qt contract:
Dropdown, closed + focused header
(closed_dropdown_keys):
ArrowUp/ArrowDownstep the committed value directly through the enabled options (no wrap -QComboBoxclamps at the ends).Alt+ArrowDownopens the popup.Space/Enteropen it through the existing focused-activation -> click -> header-toggle path.- Type-ahead: printable characters jump (and commit) the selection
to the next option whose label starts with the typed prefix,
wrapping, with a reset timer (
PopupNavConfig).
Open popup (popup_nav_lifecycle + popup_nav_keys +
follow_hover_highlight):
- Opening moves keyboard focus into the panel: onto the option row
matching the committed value (dropdown - Qt highlights the current
item) or onto the panel itself (menu - no initial highlight, like
a fresh
QMenu). The row highlight is theFocusedmarker, so.dropdown-option:hover-style CSS (routed throughcrate::hover::Interaction::hover_tint, which treatsFocusedlikeHovered) and:focusrules both style it - highlight styling stays CSS-reachable with zero new style plumbing. ArrowUp/ArrowDownmove the highlight without committing (dropdown clamps likeQListView; menus wrap likeQMenu), skipping disabled rows and separators.Home/Endjump.Enter/Spaceactivate the highlighted row through the existing focused-activation path (activate_focused_on_entersynthesizes the click; the option / menu-item dispatcher commits and closes) - so commit semantics live in exactly one place.Escapecloses without committing (the highlight never wrote the value, so the pre-open selection is intact - Qt’s revert contract).lumenc’sclose_dialogs_on_escapeflips the open signal; the lifecycle system here restores focus to the trigger.Alt+ArrowUpalso closes a dropdown popup (Qt).- Hovering a row moves the highlight to it; a keyboard move strips the hover highlight - keyboard and hover highlight are one state, last input wins (Qt).
- Highlight movement scrolls the panel’s internal scroller (skins
cap
.dropdown-panelheight via--lumen-dropdown-max-height+overflow-y: scroll) so the highlighted row stays visible.
Structs§
- Active
Popup Nav - Resource slot for the live
PopupNavSession. - Popup
NavConfig - Interaction timings for popup keyboard navigation. This
Defaultis the single Rust-side fallback (blank-no-css contract); embedders can override the resource before the first tick. - Popup
NavSession - The one live popup keyboard session (dropdown or menu panel). At
most one popup owns the keyboard at a time - nested menus are a
later wave; today’s
<menu>is a flat panel. - Type
Ahead Buffer - Accumulated type-ahead prefix, shared by the open-popup and closed-header paths (only one can be focused at a time).
Functions§
- closed_
dropdown_ keys - Closed-combobox keyboard interaction on the focused dropdown
header. Uses the option metadata mirrored onto
DropdownButton(the panel body may never have mounted). See the module docs for the exact Qt contract. - follow_
hover_ highlight - Pointer half of “keyboard highlight and hover highlight are the
same state”: hovering a row of the open panel moves the focus
highlight onto it (no
FocusVisible- pointer-driven), so the nextEnteractivates what the pointer indicated and arrow keys continue from it. Runs afterhit_testso this tick’s hover is visible. - popup_
nav_ keys - Keyboard handling while a popup session is live: highlight
movement, type-ahead, and
Alt+ArrowUpclose. Commit keys (Enter/Space) are deliberately not handled here - they flow throughlumen_input::activate_focused_on_enter->ClickEvent-> the option / menu-item click dispatchers, so keyboard and pointer commits share one code path. - popup_
nav_ lifecycle - Open/close bookkeeping for popup keyboard sessions.