Raxol.Core.FocusManager.Behaviour behaviour (Raxol v0.3.0)
View SourceDefines the behaviour for focus management services.
Summary
Callbacks
Disables a focusable component.
Enables a previously disabled focusable component.
Moves focus to the next focusable element.
Moves focus to the previous focusable element.
Alias for get_focused_element/0.
Gets the ID of the currently focused element.
Gets the next focusable element after the given one.
Gets the previous focusable element before the given one.
Checks if a component has focus.
Registers a handler function to be called when focus changes.
The handler function should accept two arguments: old_focus
and new_focus
.
Registers a focusable component.
Returns to the previously focused element.
Sets focus to a specific component.
Sets the initial focus to a specific component.
Unregisters a focus change handler function.
Unregisters a focusable component.
Callbacks
@callback disable_component(component_id :: String.t()) :: :ok
Disables a focusable component.
@callback enable_component(component_id :: String.t()) :: :ok
Enables a previously disabled focusable component.
@callback focus_next(opts :: Keyword.t()) :: :ok
Moves focus to the next focusable element.
@callback focus_previous(opts :: Keyword.t()) :: :ok
Moves focus to the previous focusable element.
@callback get_current_focus() :: String.t() | nil
Alias for get_focused_element/0.
@callback get_focused_element() :: String.t() | nil
Gets the ID of the currently focused element.
Gets the next focusable element after the given one.
Gets the previous focusable element before the given one.
Checks if a component has focus.
@callback register_focus_change_handler( handler_fun :: (String.t() | nil, String.t() | nil -> any()) ) :: :ok
Registers a handler function to be called when focus changes.
The handler function should accept two arguments: old_focus
and new_focus
.
@callback register_focusable( component_id :: String.t(), tab_index :: integer(), opts :: Keyword.t() ) :: :ok
Registers a focusable component.
@callback return_to_previous() :: :ok
Returns to the previously focused element.
@callback set_focus(component_id :: String.t()) :: :ok
Sets focus to a specific component.
@callback set_initial_focus(component_id :: String.t()) :: :ok
Sets the initial focus to a specific component.
@callback unregister_focus_change_handler( handler_fun :: (String.t() | nil, String.t() | nil -> any()) ) :: :ok
Unregisters a focus change handler function.
@callback unregister_focusable(component_id :: String.t()) :: :ok
Unregisters a focusable component.