Table of Contents

Method FocusScope

Namespace
Velvet
Assembly
Velvet.Docs.dll

FocusScope(string?, string?, string?, bool, bool, bool, bool, FiberElementProps?, StyleOverrides?, Func<VisualElement, Action>?, VNode?[]?, string?, string?, string?, IReadOnlyDictionary<string, string>?, IReadOnlyDictionary<string, string>?)

Container element whose subtree is a focus scope. Deviation (documented): a renderless, sentinel-span scope is common elsewhere; Velvet's is a real VisualElement, because UI Toolkit containment needs a subtree root for the scoped focus ring and the membership test. Any existing container can be a scope via props (FocusScope) — this factory is convenience for when no container exists yet. Style it like any Div.

public static ElementNode FocusScope(string? className = null, string? key = null, string? name = null, bool contain = false, bool restoreFocus = false, bool autoFocus = false, bool singleTabStop = false, FiberElementProps? props = null, StyleOverrides? styles = null, Func<VisualElement, Action>? refCallback = null, VNode?[]? children = null, string? whileHoverClass = null, string? whileTapClass = null, string? whileFocusClass = null, IReadOnlyDictionary<string, string>? data = null, IReadOnlyDictionary<string, string>? aria = null)

Parameters

className string
key string
name string
contain bool

Tab/Shift-Tab wrap within the subtree; a 2D/pointer move that exits is snapped back within the same event flush (a press on empty space that clears focus to nothing re-focuses on the panel's next tick).

restoreFocus bool

On unmount while holding focus, refocus the element focus came from when it first entered the scope.

autoFocus bool

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

singleTabStop bool

The subtree behaves as one Tab stop (roving); engine 2D arrow/dpad navigation inside is untouched.

props FiberElementProps
styles StyleOverrides
refCallback Func<VisualElement, Action>
children VNode[]
whileHoverClass string
whileTapClass string
whileFocusClass string
data IReadOnlyDictionary<string, string>
aria IReadOnlyDictionary<string, string>

Returns

ElementNode

The created ElementNode.