Home > widget-integration > InstantSearchSelectors > waitForPredictiveSearchContainer

InstantSearchSelectors.waitForPredictiveSearchContainer() method

Wait for a predictive search container inside a dialog element.

Shopify themes render predictive search components asynchronously inside their search dialogs. This method waits for one of the known selectors to become available so ISW can inject itself adjacent to the container.

**Legacy**: waitForPredictiveSearchContainer(dialog) standalone function **New**: Instance method on selectors service with timeout support

Signature:

waitForPredictiveSearchContainer(dialog: HTMLElement, timeout?: number): Promise<HTMLElement | null>;

Parameters

Parameter

Type

Description

dialog

HTMLElement

The dialog / modal element to search within

timeout

number

(Optional) Maximum wait time in ms (default 10 000). Pass 0 to wait indefinitely.

Returns:

Promise<HTMLElement | null>

The predictive search container, or null if not found within timeout