Skip to main content

popup_nav_lifecycle

Function popup_nav_lifecycle 

Source
pub fn popup_nav_lifecycle(
    commands: Commands<'_, '_>,
    nav: ResMut<'_, ActivePopupNav>,
    tracker: ResMut<'_, FocusTracker>,
    store: ResMut<'_, PropertyStore>,
    panels: Query<'_, '_, (Entity, &PopupPanel)>,
    headers: Query<'_, '_, (Entity, &DropdownButton)>,
    options: Query<'_, '_, (Entity, &DropdownOptionButton, Option<&TextContent>, Has<Disabled>, Option<&DocumentOrder>)>,
    items: Query<'_, '_, (Entity, &MenuItemButton, Option<&TextContent>, Has<Disabled>, Option<&DocumentOrder>)>,
    focus_visibles: Query<'_, '_, (), With<FocusVisible>>,
    parents: Query<'_, '_, &ChildOf>,
    transforms: Query<'_, '_, &Transform>,
    scrolls: Query<'_, '_, (&Transform, &mut Scroll, &mut ScrollOffset)>,
)
Expand description

Open/close bookkeeping for popup keyboard sessions.

  • A popup whose open signal flips true starts a session: focus moves into the panel (selected row for dropdowns, the panel itself for menus) and the highlight is scrolled into view once layout has measured the freshly-mounted panel.
  • A session whose signal flips false (Escape, commit click, outside-press dismissal, script write) ends: focus returns to the dropdown header / the menu’s pre-open holder - but only when focus still sits inside the panel, so a close caused by focusing another widget doesn’t yank focus back.
  • Focus escaping the panel while open (Tab, click-to-focus on an input) closes the popup - Qt popups dismiss on focus-out.