Home > widget-integration > InstantSearchSelectors > getActiveContainer

InstantSearchSelectors.getActiveContainer() method

Resolve the ISW container the theme is actually displaying.

The mobile/desktop containers are toggled by the widget/theme CSS (media queries), whose breakpoint may not match the JS innerWidth < 991 heuristic. When that happens, the width guess resolves the *hidden* container and the visible panel is never unhidden (the first-open bug). Prefer the container that is genuinely on screen (offsetParent !== null); fall back to the width-based selector only when neither is resolvable yet (e.g. mid-init, before the containers are rendered).

Signature:

getActiveContainer(): HTMLElement | null;

Returns:

HTMLElement | null

The active ISW container element, or null