pub enum TraversalScopePolicy {
Continue,
Cycle,
}Expand description
Policy for a focus traversal scope, declared via the FocusScope
wrapper widget. Controls what Tab / Shift+Tab does when it reaches the
scope’s ends.
A scope groups + scopes the tab_index numbering of its descendants:
two sibling scopes that both number their children 1, 2, 3 never
interleave — each scope is an independent, ordered unit within its
parent. This is Teksilo’s analogue of Flutter FocusTraversalGroup /
WPF KeyboardNavigation.TabNavigation.
Variants§
Continue
Tab flows out of the scope at its ends into the enclosing scope’s
next member. The scope groups tab_index numbering without trapping
focus — use for logical regions in a continuous Tab order (e.g. dock
panels, where each panel numbers its own controls without colliding
with sibling panels).
Cycle
Tab wraps within the scope and never exits via keyboard navigation. Use for modal dialogs — the one surface whose pattern (ARIA’s Dialog (Modal)) actually calls for containing focus.
Not for popovers or menus. Those implement Disclosure and Menu,
which mandate the opposite: Tab is an exit gesture there, and the
framework already answers it by dismissing the overlay focus leaves
rather than by trapping focus inside it. Wrapping such an overlay in a
Cycle scope defeats that — focus can no longer leave, so the
dismissal never fires and the panel becomes keyboard-inescapable except
via Escape.
Trait Implementations§
Source§impl Clone for TraversalScopePolicy
impl Clone for TraversalScopePolicy
Source§fn clone(&self) -> TraversalScopePolicy
fn clone(&self) -> TraversalScopePolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more