Class FocusScopeSettings
- Namespace
- Velvet
- Assembly
- Velvet.Docs.dll
Focus-management behavior for a container subtree: Contain, RestoreFocus, and AutoFocus are straightforward toggles; SingleTabStop is the WAI-ARIA composite-widget (roving) contract adapted to UI Toolkit, where arrow/dpad movement inside the group is engine-native 2D navigation. Record structural equality simplifies DiffProps.
public sealed record FocusScopeSettings
- Inheritance
-
objectFocusScopeSettings
Constructors
- FocusScopeSettings(bool, bool, bool, bool)
Focus-management behavior for a container subtree: Contain, RestoreFocus, and AutoFocus are straightforward toggles; SingleTabStop is the WAI-ARIA composite-widget (roving) contract adapted to UI Toolkit, where arrow/dpad movement inside the group is engine-native 2D navigation. Record structural equality simplifies DiffProps.
Properties
- AutoFocus
On mount (the scope's FIRST attach-to-panel, never a re-attach such as a keyed reorder's), focus the scope's first focusable descendant (skipped when focus is already inside the scope).
- Contain
Tab/Shift-Tab wrap within the subtree (computed by a focus ring scoped to it); a 2D/pointer move that exits the subtree is snapped back within the same event flush unless it landed in a contained scope created after this one. A press on empty non-focusable space clears focus to nothing first — that path re-focuses the scope on the panel's next scheduler tick, as does focus that moves to another panel unless it lands in a portal declared inside the scope or in a contained scope created after this one.
- Orientation
The axis arrow/d-pad moves travel inside a SingleTabStop group, as React Aria's
useToolbartakes anorientation. A move on the other axis is ignored before it moves focus. Of nested groups, the outermost one's value decides; without SingleTabStop it is not read.
- RestoreFocus
On unmount while holding focus, refocus the element that held focus when the scope mounted (skipped if that element is gone, detached, or cannot grab focus).
- SingleTabStop
The subtree behaves as one Tab stop: Tab from inside exits past the remaining members (wrapping within the nearest containing scope, if any); Tab entering from outside — in either direction — lands on the last-focused member, else the scope's first. An arrow/d-pad move steps to the next member in hierarchy order (right, down) or the previous one (left, up) and never leaves the subtree; Orientation ignores one axis's moves and Wrap continues past an end.
- Wrap
Inside a SingleTabStop group, an arrow/d-pad move past the last member lands on the first and one before the first lands on the last, as a React Aria radio group's arrows do. Without it the move leaves focus where it is, as a React Aria toolbar's arrows do. Of nested groups, the outermost one's value decides; without SingleTabStop it is not read.