Home > widget-integration > InstantSearchController > getNavigationRoot

InstantSearchController.getNavigationRoot() method

Resolve the DOM root for keyboard navigation.

ISW renders the mobile and desktop containers side by side and populates both with suggestion markup on every query (see replaceHTML). A document-wide lookup therefore returns both sets — querySelectorAll is not visibility-aware — so arrow keys land on the off-screen container's items first. Scope navigation to the container that is actually on screen.

Falls back to the generic container, then document, so navigation never resolves to an empty list mid-init or in environments where offsetParent is unavailable.

Signature:

protected getNavigationRoot(): ParentNode;

Returns:

ParentNode

The root to query navigable elements from