Focus management for the element tree.
Tracks which element is currently focused, supports tab navigation (next/prev focusable), and resolves focus targets from mouse clicks by walking up the tree to find the nearest focusable ancestor.
Focus state is a simple value — no process needed. The Runtime holds the current focus state in its model.
Summary
Functions
Clear focus.
Set focus to a specific element id.
Move focus to the next focusable element (Tab).
Move focus to the previous focusable element (Shift+Tab).
Build focus state from an element tree.
Resolve focus target from a hit_id by walking up the tree.
Update focus state when the tree changes (e.g., elements added/removed).
Types
Functions
Clear focus.
Set focus to a specific element id.
Move focus to the next focusable element (Tab).
Move focus to the previous focusable element (Shift+Tab).
@spec from_tree(ElixirOpentui.Element.t()) :: t()
Build focus state from an element tree.
@spec resolve_focus_target(ElixirOpentui.Element.t(), term()) :: term() | nil
Resolve focus target from a hit_id by walking up the tree.
@spec update_tree(t(), ElixirOpentui.Element.t()) :: t()
Update focus state when the tree changes (e.g., elements added/removed).