class A11yFocusManager

Defined at line 30 of file ../../src/ui/a11y/lib/screen_reader/focus/a11y_focus_manager.h

The A11yFocusManager keeps track of a11y focus and a cache of the "last

focused node" for each view.

The a11y focus is defined as the semantic node which is selected in a certain

view by the screen reader. There is only (up to) one active a11y focus, meaning that

the screen reader cares only about (up to) one node at a time.

The view in a11y focus and the view in input focus are almost always kept in sync:

- If the system changes the Focus Chain to a different view, the a11y focus

also follows. (If a node was previously focused in that view, it regains

focus; otherwise the a11y focus is lost.)

- If the a11y focus is changed, this will trigger a Focus Chain Update if the

active a11y focus is moving to another view (except in rare situations

involving the virtual keyboard).

(For clarity, the following terms are equivalent: 'view in input focus', 'view in Scenic focus',

and 'view at the end of the focus chain'.)

Public Methods

std::optional<A11yFocusInfo> GetA11yFocus ()

Returns the current a11y focus, if any.

void RestoreA11yFocusToInputFocus ()

Try to restore the a11y focus to the view in input focus, if possible.

After this method completes, GetA11yFocus() will generally return a non-nullopt

value (except in some rare situations).

void SetA11yFocus (zx_koid_t koid, uint32_t node_id, SetA11yFocusCallback callback)

Tries to set the a11y focus.

If the new focus is in a different view from the current input focus, then

we'll send a focus chain update request to scenic -- unless the new view

contains a visible virtual keyboard.

If the scenic focus chain update succeeds (or was eschewed), we'll

(1) set the a11y focus to {koid, node_id}, (2) redraw highlights, and (3)

call the callback with 'true'.

Otherwise, we'll call the callback with 'false'.

void ClearA11yFocus ()

Clears existing a11y focus, and forgets the current view's "last focused node".

void RedrawHighlights ()

If a node is in a11y focus, redraws the current highlights (useful if the

node's bounding box has changed).

Otherwise, clears any highlights.

void set_on_a11y_focus_updated_callback (OnA11yFocusUpdatedCallback on_a11y_focus_updated_callback)

Registers a callback that is invoked when the a11y focus is updated. For now, only one callback

can be registered at a time.

void ~A11yFocusManager ()

Defined at line 46 of file ../../src/ui/a11y/lib/screen_reader/focus/a11y_focus_manager.h

Records