Skip to main content

@lexical/react/useFocusManager

Interfaces

FocusManagerOptions

Defined in: packages/lexical-react/src/useFocusManager.ts:19

Properties

toolbarItemSelector?

optional toolbarItemSelector?: string

Defined in: packages/lexical-react/src/useFocusManager.ts:26

Selector used to find the toolbar's first focusable item when activating via the shortcut. Defaults to non-disabled direct-child buttons (the same scope used by useRovingTabIndex), so the active roving item naturally receives focus.

Functions

useFocusManager()

useFocusManager(editor, toolbarRef, options?): void

Defined in: packages/lexical-react/src/useFocusManager.ts:39

Implements the editor-to-toolbar focus jump recommended by the WAI-ARIA APG editor menubar pattern: Alt+F10 inside the editor moves focus to the first focusable in toolbarRef, and Escape inside the toolbar returns focus to the editor.

The hook only wires the navigation. Selection restoration relies on the editor's own focus handling; the editor's last selection is preserved across the jump so that toolbar commands act on the same range.

Parameters

editor

LexicalEditor

toolbarRef

RefObject<HTMLElement | null>

options?

FocusManagerOptions = {}

Returns

void