Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface KeyboardFocusHookOptions<E>

remarks

@since 5.0.0

Type parameters

  • E: HTMLElement

Hierarchy

Index

Properties

onDecrement?: KeyboardFocusHandler<E>

This is called whenever one of the {@link KeyboardMovementBehavior.decrementKeys} are pressed.

onFocus?: FocusEventHandler<E>
onIncrement?: KeyboardFocusHandler<E>

This is called whenever one of the {@link KeyboardMovementBehavior.incrementKeys} are pressed.

onJumpToFirst?: KeyboardFocusHandler<E>

This is called whenever one of the {@link KeyboardMovementBehavior.jumpToFirstKeys} are pressed.

onJumpToLast?: KeyboardFocusHandler<E>

This is called whenever one of the {@link KeyboardMovementBehavior.jumpToLastKeys} are pressed.

onKeyDown?: KeyboardEventHandler<E>
onSearch?: KeyboardFocusHandler<E>

This is called whenever a single letter has been pressed and KeyboardMovementBehavior.searchable is true.

Methods

  • getDefaultFocusIndex(elements: readonly HTMLElement[], container: E): number
  • A function that can be used to get the default focus index when the container element first gains focus. If this returns -1, no child element will be focused and the container will maintain focus instead.

    Parameters

    • elements: readonly HTMLElement[]

      The current list of elements that can be focused within the container element

    • container: E

      The container element that gained focus

    Returns number

  • onFocusChange(element: HTMLElement, nextFocusIndex: number): void
  • An optional function to call when the custom focused element should change. The default value is just to call element.focus().

    Parameters

    • element: HTMLElement

      The element that should gain custom focus

    • nextFocusIndex: number

      The next focus index which can be used for additional movement behavior.

    Returns void

Generated using TypeDoc