device-navigation - v4.7.3
    Preparing search index...

    Class NavController

    Allows navigation around the nav tree contained within the given rootElement. If there is no nav tree, all operations simply do nothing. For a full example, see vir-test-app.element.ts.

    import {NavController, NavDirection} from 'device-navigation';

    const navController = new NavController(host);

    window.addEventListener('keydown', (event) => {
    if (event.code === 'ArrowDown') {
    navController.navigate({direction: NavDirection.Down, allowWrapper: false});
    } else if (event.code === 'ArrowUp') {
    navController.navigate({direction: NavDirection.Up, allowWrapper: false});
    }
    // etc. all other navigation directions
    });

    Hierarchy

    Index
    cachedNavTree: Readonly<NavTree> | undefined
    currentNavEntry: Readonly<CurrentNavEntry> | undefined
    locked: boolean = false

    If true, all nav is prevented.

    navEntries: Set<Readonly<NavEntry>> = ...
    needsUpdate: boolean = false

    If true, the nav tree will rebuild on next operation.

    options: NavControllerOptions = {}
    rootElement: HTMLElement
    • Internal

      Schedules a post-render pass that ensures a valid nav entry is focused when alwaysRequireFocused is enabled.

      This reconciles controller state after dynamic DOM updates: it keeps the current entry when it still exists in the rebuilt nav tree, clears it when it was removed or became non-navigable, and focuses the tree's default entry when no current entry remains.

      Parameters

      • force: boolean = false

      Returns void