Expand description
Focus and tab-order model.
Portable focusability (per-kind defaults plus a WidgetSpec override),
2D directional projection navigation engine (FocusDirection::Up,
FocusDirection::Down, FocusDirection::Left, FocusDirection::Right),
sequential tab traversal (FocusDirection::TabNext, FocusDirection::TabPrev),
spatial candidate scoring, and focus ring styling metrics conforming to
platform guidelines and WCAG 2.4.7 / 2.4.11 / 2.4.13 requirements.
See the cap-002b-native-focus-contract.md decision record for the normative contract.
Structs§
- Focus
Candidate - A spatial node candidate for focus navigation.
- Focus
Grid - A structured 2D multi-column container for deterministic grid navigation, boundary wrapping, and accelerated directional stepping.
- Focus
Projection Score - Detailed projection metric breakdown for spatial navigation ranking.
- Focus
Rect - A 2D bounding rectangle in logical coordinates used for spatial focus calculation.
- Focus
Ring Metrics - Metrics and styling parameters for rendering a native-grade visual focus ring conforming to platform guidelines and WCAG 2.4.7 / 2.4.11 / 2.4.13 requirements.
- Focus
Trap - Directional focus trap primitive that confines keyboard and spatial focus navigation to an enclosed container, dialog, or subset of widgets.
- Grid
Accelerator - Acceleration tracker for repeated directional navigation in multi-column grids and containers.
- Projection
Options - Tuning parameters for spatial 2D projection scoring, including primary/orthogonal weights and aspect-ratio distance weighting.
Enums§
- Focus
Direction - Direction for keyboard, gamepad, and programmatic focus navigation.
- Focus
Ring Style - Visual style pattern for focus indicator borders.
- Focus
Trap Boundary Policy - Policy governing boundary containment behavior when focus navigation reaches the boundary edge of a focus trap.
- Focus
Trap Outcome - The result outcome of navigating within a directional focus trap.
- Grid
Wrap Mode - Boundary wrap-around mode for multi-column grid navigation.
Functions§
- compute_
projection_ score - Computes the directional projection score from
sourcetotargetindirectionusing default standard projection weights. - compute_
projection_ score_ options - Computes the directional projection score from
sourcetotargetindirectionwith custom projection and aspect-ratio weighting options. - default_
focusable - Whether a widget kind is keyboard-focusable by default.
- find_
next_ focus - Unified focus navigation dispatch across 2D directional and 1D sequential modes.
- find_
next_ focus_ 2d - Finds the next focus target in 2D spatial layout using directional beam projection and standard default projection options.
- find_
next_ focus_ 2d_ options - Finds the next focus target in 2D spatial layout using directional beam projection with custom projection and aspect-ratio weighting options.
- find_
next_ focus_ tab - Finds the next focus target in sequential tab / reading order.
- is_
focusable - Resolves a widget’s focusability: the explicit
WidgetSpec.focusableoverride when present, otherwise the per-kind default.