Skip to content

Interface: FocusTracker<F>

Defined in: modal/focus.ts:17

Focus as tracked state (modal-interaction-lessons §4.6).

A modal editor that must decide "where does this dictated text fold in?" cannot ask the DOM: document.activeElement lies during transitions — focus steals (permission pickers, cmd-tab), blur-before-click ordering, and shadow retargeting all make the query answer "wherever focus happens to be mid-flight", not "where the user is working". So the surface records its own notion of focus as plain state, updated from its focus/click handlers, and decision code reads that.

Deliberately tiny — the value is naming the pattern so the DOM query never creeps back into decision code. Tab order inside a modal editor is the app's explicit hop (two stops, wrap around), not native tab flow.

Type Parameters

F

F extends string

Methods

last()

last(): F

Defined in: modal/focus.ts:19

The last place the user deliberately put focus.

Returns

F


set()

set(focus): void

Defined in: modal/focus.ts:21

Record a deliberate focus move (call from focus/click handlers).

Parameters

focus

F

Returns

void