platform-bible-react
    Preparing search index...

    Function useListbox

    • Hook for handling keyboard navigation of a listbox.

      Parameters

      • UseListboxProps: UseListboxProps

        The properties for configuring the listbox behavior.

      Returns {
          activeId: undefined | string;
          focusOption: (id: string) => void;
          handleKeyDown: (evt: KeyboardEvent<HTMLElement>) => void;
          listboxRef: RefObject<HTMLElement>;
          selectedId: undefined | string;
      }

      An object containing:

      • listboxRef: A ref to be attached to the listbox container element (e.g., <ul>), used for focus management.
      • activeId: The id of the currently focused (active) option, or undefined if none is focused.
      • selectedId: The id of the currently selected option, or undefined if none is selected.
      • handleKeyDown: A keyboard event handler to be attached to the listbox container for handling navigation and selection.
      • focusOption: A function to programmatically focus a specific option by id.