Raxol.UI.Components.Input.SelectList.Navigation (Raxol v0.4.0)

View Source

Handles keyboard navigation functionality for the SelectList component.

Summary

Functions

Calculates the index of the option clicked based on the y position and current state. Returns the index, or -1 if out of bounds.

Handles arrow down key press, moving focus down one item.

Handles arrow up key press, moving focus up one item.

Handles end key press, moving focus to the last item.

Handles home key press, moving focus to the first item.

Handles page down key press, moving focus down one page.

Handles page up key press, moving focus up one page.

Updates focus index and scroll position to ensure the focused item is visible.

Recalculates scroll position to ensure the focused item is visible after a resize or visible_height change. Always returns a valid state map.

Functions

calculate_clicked_index(y, state)

Calculates the index of the option clicked based on the y position and current state. Returns the index, or -1 if out of bounds.

handle_arrow_down(state)

Handles arrow down key press, moving focus down one item.

handle_arrow_up(state)

Handles arrow up key press, moving focus up one item.

handle_end(state)

Handles end key press, moving focus to the last item.

handle_home(state)

Handles home key press, moving focus to the first item.

handle_page_down(state)

Handles page down key press, moving focus down one page.

handle_page_up(state)

Handles page up key press, moving focus up one page.

update_focus_and_scroll(state, new_index)

Updates focus index and scroll position to ensure the focused item is visible.

update_scroll_position(state)

Recalculates scroll position to ensure the focused item is visible after a resize or visible_height change. Always returns a valid state map.