Keyboard and focus
HeroGPUI components participate in GPUI focus. The window root has to opt in, then Tab, Escape, and the field keys work as documented on each page.
Wrap the window root
Call app_focus_root around the element you return from Render. Without it, focus-visible rings and Tab movement across components do not run:
1app_focus_root(
2 div()
3 .size_full()
4 .bg(cx.colors().background)
5 .text_color(cx.colors().foreground)
6 .child(/* your tree */),
7 window,
8 cx,
9)What you get
- Tab and Shift+Tab move between focusable controls in tree order.
- Focus-visible rings appear for keyboard focus, not every pointer click.
- Enter and Space press a focused Button.
- Escape dismisses an open Modal, Drawer, Popover, or Tooltip.
- Arrow keys move inside lists, menus, tabs, sliders, and segmented date fields. Each component page lists the exact keys under States.
Disabled and pending
is_disabled(true) removes the control from the tab order and ignores presses. is_pending(true) blocks presses but keeps the focus stop, so a submit button can stay on the keyboard while work finishes.
Your window, your shortcuts
Application shortcuts — save, new file, command palettes — belong on the window or view you own. Components do not steal global keys beyond the interactions they document.