Table of Contents

Method FocusScope

Namespace
Velvet
Assembly
Velvet.Docs.dll

FocusScope(VNode?[]?, string?, bool, bool, bool, bool, FocusScopeOrientation, bool)

A focus scope over children, React Aria's FocusScope. It renders no element around them: they lay out as the parent's own children, between two hidden elements that mark where the scope starts and ends, as React Aria's renders two hidden spans. To make an existing container the scope instead, set its FocusScope.

public static ComponentNode FocusScope(VNode?[]? children = null, string? key = null, bool contain = false, bool restoreFocus = false, bool autoFocus = false, bool singleTabStop = false, FocusScopeOrientation orientation = FocusScopeOrientation.Both, bool wrap = false)

Parameters

children VNode[]

The scope's content.

key string

Key used to disambiguate siblings at the same position.

contain bool

Tab/Shift-Tab wrap within the scope; a 2D/pointer move that exits is snapped back within the same event flush unless it lands in a contained scope created after this one (a press on empty space that clears focus to nothing re-focuses on the panel's next tick, and so 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).

restoreFocus bool

On unmount while holding focus, refocus the element that held focus when the scope mounted.

autoFocus bool

On mount (first attach only — never a keyed reorder's re-attach), focus the scope's first focusable element.

singleTabStop bool

The scope behaves as one Tab stop (roving); arrow/dpad moves step between members in hierarchy order and never leave the scope.

orientation FocusScopeOrientation

With singleTabStop, the axis arrow/dpad moves travel; a move on the other axis is ignored. Not read without singleTabStop.

wrap bool

With singleTabStop, an arrow/dpad move past one end lands on the other. Not read without singleTabStop.

Returns

ComponentNode

The created ComponentNode.