Opinionated interaction handler for keyboard-driven focus navigation through graph elements (nodes and relationships).

By default, Tab / Shift+Tab cycle focus through elements, Escape exits the graph, and Shift+F10 call the onContextMenu callback with the focused element. All keys can be reconfigured via KeyboardInteractionOptions.

Callbacks are fired for focus/blur transitions and context-menu activation, following the same one-way data-flow pattern as the other interaction handlers.

Hierarchy

Constructors

  • Creates a new keyboard interaction handler.

    Parameters

    • nvl: NVL

      The NVL instance to attach the interaction handler to.

    • options: KeyboardInteractionOptions = {}

      Options for the keyboard interaction handler.

    Returns KeyboardInteraction

Accessors

  • get currentOptions(): P
  • Returns the current options of the interaction.

    Returns P

    The current options of the interaction.

Methods

  • Removes all related event listeners from the container.

    Returns void

  • Returns the currently focused element, if any.

    Returns undefined | Node | Relationship

  • Remove a callback for a given event of type.

    Parameters

    • name: string

      The name of the event.

    Returns void

  • Enables or disables global text selection during a drag or pan operation.

    Parameters

    • enable: boolean

      Whether to enable or disable global text selection.

    • OptionaleventFunction: ((this: HTMLElement, ev: MouseEvent) => void)

      The event function to be added/removed when text selection is disabled/enabled.

        • (this, ev): void
        • Parameters

          • this: HTMLElement
          • ev: MouseEvent

          Returns void

    Returns void

  • Add or update a callback for a given event of type.

    Parameters

    • name: string

      The name of the event.

    • callback: boolean | ((...args: unknown[]) => void)

      The callback to be called when the event is triggered.

    Returns void