Skip to main content

Class: ComboboxDriver<ContentT>

Defined in: packages/component-driver-radix-v1/src/components/ComboboxDriver.ts:75

Driver for the shadcn/ui "Combobox" COMPOSITION: a Radix Popover whose content hosts a cmdk (https://cmdk.paco.me) Command palette. This is not a Radix primitive — Radix ships no Combobox — so this driver deliberately straddles two libraries (#1007):

  • The trigger + portalled-panel lifecycle is Radix Popover's, inherited from PopoverDriver unchanged (trigger-anchored aria-controls → byLinkedElement content resolution; see that class's doc for why the static portal-hook recipe does not work for popovers).
  • Everything inside the panel is cmdk's: the filter input, the filtered role="listbox" of role="option" items, the keyboard-highlight state. The anchors are cmdk's public styling attributes ([cmdk-input], [cmdk-item], ...) plus the ARIA it renders — never utility classes.

Value semantics — cmdk DOES render data-value (unlike Radix Select.Item, whose label-only identity the #923 decision documents): every Command.Item carries its value prop (or, when omitted, its text content) as a data-value attribute, and the keyboard-highlighted item is marked data-selected="true". Item identity in this driver is therefore VALUE-based (selectByValue, getHighlightedValue) — the opposite of SelectDriver's label-based surface — with selectByLabel also provided for text-first scenes.

Filtering is cmdk-internal: typing into the input UNMOUNTS non-matching items (they are removed from the DOM, not hidden), and when nothing matches cmdk mounts Command.Empty ([cmdk-empty]). getOptionCount/ getOptionValues therefore reflect the CURRENT filter state by construction, and isEmpty() reads the empty element's presence.

v1 scope limits (documented per #1007's best-effort framing):

  • The selected value is read from the trigger's visible text (getSelectedLabel) — the composition keeps selection state in consumer React state rendered into the trigger (as shadcn's recipe does); there is no DOM attribute carrying it.
  • Command.Group headings are not modeled; item enumeration recurses through wrapper elements (childListHelper's '*' group descent), so grouped items are still found, in document order.
  • cmdk inside Radix Dialog (the "command palette" usage) is out of scope — that pairing is DialogDriver territory and would motivate the standalone component-driver-cmdk package #1007 names if demand appears.

Extends​

Type Parameters​

ContentT​

ContentT extends ScenePart = { }

Constructors​

Constructor​

new ComboboxDriver<ContentT>(triggerLocator, interactor, option?): ComboboxDriver<ContentT>

Defined in: packages/component-driver-radix-v1/src/components/PopoverDriver.ts:46

Parameters​

triggerLocator​

PartLocator

interactor​

Interactor

option?​

Partial<IContainerDriverOption<ContentT, { }>>

Returns​

ComboboxDriver<ContentT>

Inherited from​

PopoverDriver.constructor

Accessors​

driverName​

Get Signature​

get driverName(): string

Defined in: packages/component-driver-radix-v1/src/components/ComboboxDriver.ts:215

Returns​

string

Overrides​

PopoverDriver.driverName

Methods​

getFilterText()​

getFilterText(): Promise<string | null>

Defined in: packages/component-driver-radix-v1/src/components/ComboboxDriver.ts:108

The cmdk filter input's current text. Opens the panel first.

Returns​

Promise<string | null>


getHighlightedValue()​

getHighlightedValue(): Promise<Optional<string>>

Defined in: packages/component-driver-radix-v1/src/components/ComboboxDriver.ts:138

The data-value of the keyboard-highlighted option (data-selected="true"), or undefined when none.

Returns​

Promise<Optional<string>>


getOptionCount()​

getOptionCount(): Promise<number>

Defined in: packages/component-driver-radix-v1/src/components/ComboboxDriver.ts:119

The number of options matching the CURRENT filter (cmdk unmounts filtered-out items).

Returns​

Promise<number>


getOptionValues()​

getOptionValues(): Promise<string[]>

Defined in: packages/component-driver-radix-v1/src/components/ComboboxDriver.ts:125

The data-value of every option matching the current filter, in document order.

Returns​

Promise<string[]>


getSelectedLabel()​

getSelectedLabel(): Promise<string | null>

Defined in: packages/component-driver-radix-v1/src/components/ComboboxDriver.ts:93

The trigger's visible text — the selected label in the shadcn composition (see class doc).

Returns​

Promise<string | null>


highlightNext()​

highlightNext(): Promise<void>

Defined in: packages/component-driver-radix-v1/src/components/ComboboxDriver.ts:181

Move cmdk's keyboard highlight down one option (ArrowDown on the filter input).

Returns​

Promise<void>


highlightPrevious()​

highlightPrevious(): Promise<void>

Defined in: packages/component-driver-radix-v1/src/components/ComboboxDriver.ts:187

Move cmdk's keyboard highlight up one option (ArrowUp on the filter input).

Returns​

Promise<void>


isEmpty()​

isEmpty(): Promise<boolean>

Defined in: packages/component-driver-radix-v1/src/components/ComboboxDriver.ts:114

Whether cmdk's Command.Empty is mounted — i.e. the current filter matches nothing.

Returns​

Promise<boolean>


selectByLabel()​

selectByLabel(label): Promise<void>

Defined in: packages/component-driver-radix-v1/src/components/ComboboxDriver.ts:169

Click the option whose visible label equals label, iterating the mounted (filter-matching) options.

Parameters​

label​

string

Returns​

Promise<void>

Throws​

when no such option is mounted.


selectByValue()​

selectByValue(value): Promise<void>

Defined in: packages/component-driver-radix-v1/src/components/ComboboxDriver.ts:152

Click the option whose data-value equals value (must match the current filter — cmdk unmounts filtered-out items). Opens the panel first; the composition's onSelect conventionally closes it.

Parameters​

value​

string

Returns​

Promise<void>

Throws​

when no such option is mounted.


selectHighlighted()​

selectHighlighted(): Promise<void>

Defined in: packages/component-driver-radix-v1/src/components/ComboboxDriver.ts:193

Select the keyboard-highlighted option (Enter on the filter input).

Returns​

Promise<void>


setFilter()​

setFilter(text): Promise<void>

Defined in: packages/component-driver-radix-v1/src/components/ComboboxDriver.ts:102

Replace the cmdk filter input's text (empty string clears the filter). Opens the panel first — the input only mounts while open.

Parameters​

text​

string

Returns​

Promise<void>

Inherited members (27)

Properties​

commutableOption​

readonly commutableOption: CommutableComponentDriverOption

Defined in: packages/core/dist/index.d.mts:1182

The component-agnostic slice of the constructor option that is safe to share across the whole driver tree — everything the constructor received EXCEPT the component-specific parts, which each driver owns for itself. Parent drivers pass this straight to the constructors of children they create dynamically (see the list helpers). See CommutableComponentDriverOption.

Inherited from​

PopoverDriver.commutableOption


interactor​

readonly interactor: Interactor

Defined in: packages/core/dist/index.d.mts:1172

Inherited from​

PopoverDriver.interactor

Accessors​

content​

Get Signature​

get content(): ScenePartDriver<ContentT>

Defined in: packages/core/dist/index.d.mts:947

Returns​

ScenePartDriver<ContentT>

Inherited from​

PopoverDriver.content


locator​

Get Signature​

get locator(): PartLocator

Defined in: packages/core/dist/index.d.mts:1229

Return the locator of the component

Returns​

PartLocator

Inherited from​

PopoverDriver.locator


parts​

Get Signature​

get parts(): ScenePartDriver<T>

Defined in: packages/core/dist/index.d.mts:1225

Return driver instance of all the named parts

Returns​

ScenePartDriver<T>

Inherited from​

PopoverDriver.parts

Methods​

click()​

click(option?): Promise<void>

Defined in: packages/core/dist/index.d.mts:1253

Parameters​
option?​

Partial<ClickOption>

Returns​

Promise<void>

Inherited from​

PopoverDriver.click


close()​

close(): Promise<void>

Defined in: packages/component-driver-radix-v1/src/components/PopoverDriver.ts:90

Close the popover by clicking its trigger, if open.

Returns​

Promise<void>

Inherited from​

PopoverDriver.close


closeByEscape()​

closeByEscape(timeoutMs?): Promise<boolean>

Defined in: packages/component-driver-radix-v1/src/components/PopoverDriver.ts:123

Dismiss the popover by pressing Escape, then wait for it to close. Radix's DismissableLayer handles Escape globally while the popover is open — the same dismissal path a real user relies on. Popover (unlike modal Dialog) renders no backdrop element to click through, so this is the only universally reachable programmatic dismissal beyond close().

Parameters​
timeoutMs?​

number = defaultTransitionDuration

Returns​

Promise<boolean>

Inherited from​

PopoverDriver.closeByEscape


exists()​

exists(): Promise<boolean>

Defined in: packages/component-driver-radix-v1/src/components/PopoverDriver.ts:70

Whether the popover's content is mounted. Radix mounts Popover.Content only while open (forceMount off by default); when closed, the trigger's aria-controls link is absent, so the underlying content locator cannot resolve — exists() treats that unresolvable-link failure as "not attached" rather than letting it throw.

Returns​

Promise<boolean>

Inherited from​

PopoverDriver.exists


focus()​

focus(option?): Promise<void>

Defined in: packages/core/dist/index.d.mts:1262

Parameters​
option?​

Partial<FocusOption>

Returns​

Promise<void>

Inherited from​

PopoverDriver.focus


getAttribute()​

getAttribute(attributeName): Promise<Optional<string>>

Defined in: packages/core/dist/index.d.mts:1247

Parameters​
attributeName​

string

Returns​

Promise<Optional<string>>

Inherited from​

PopoverDriver.getAttribute


getText()​

getText(): Promise<Optional<string>>

Defined in: packages/core/dist/index.d.mts:1246

Get the combined text content of the component

Returns​

Promise<Optional<string>>

If the component exists and has content, it should return the text or otherwise undefined

Inherited from​

PopoverDriver.getText


hover()​

hover(option?): Promise<void>

Defined in: packages/core/dist/index.d.mts:1254

Parameters​
option?​

Partial<HoverOption>

Returns​

Promise<void>

Inherited from​

PopoverDriver.hover


isOpen()​

isOpen(): Promise<boolean>

Defined in: packages/component-driver-radix-v1/src/components/PopoverDriver.ts:78

Returns​

Promise<boolean>

Inherited from​

PopoverDriver.isOpen


isVisible()​

isVisible(): Promise<boolean>

Defined in: packages/core/dist/index.d.mts:1336

Whether the component is visible. Visibility is defined that the component does not have the CSS property display: none, visibility: hidden, or opacity: 0. However this does not check whether the component is within the viewport.

Returns​

Promise<boolean>

true if the component is visible, false otherwise

Inherited from​

PopoverDriver.isVisible


open()​

open(): Promise<void>

Defined in: packages/component-driver-radix-v1/src/components/PopoverDriver.ts:83

Open the popover by clicking its trigger, if not already open.

Returns​

Promise<void>

Inherited from​

PopoverDriver.open


pressKey()​

pressKey(key, option?): Promise<void>

Defined in: packages/core/dist/index.d.mts:1268

Dispatch a keyboard key press on the component. See Interactor.pressKey.

Parameters​
key​

string

A KeyboardEvent.key value, e.g. 'Escape', 'Backspace', 'Enter'

option?​

Partial<PressKeyOption>

Reserved for future modifier-key support

Returns​

Promise<void>

Inherited from​

PopoverDriver.pressKey


runtimeCssSelector()​

runtimeCssSelector(): Promise<string>

Defined in: packages/core/dist/index.d.mts:1367

Get the runtime CSS selector of the component. This is useful for debugging and testing purposes.

Returns​

Promise<string>

The runtime CSS selector of the component

Inherited from​

PopoverDriver.runtimeCssSelector


scrollIntoView()​

scrollIntoView(): Promise<void>

Defined in: packages/core/dist/index.d.mts:1289

Scroll the component into the viewport. See Interactor.scrollIntoView.

jsdom has no layout engine, so the scroll is a no-op there and behavioral assertions (visibility, offset) are E2E-only.

Returns​

Promise<void>

Inherited from​

PopoverDriver.scrollIntoView


typeText()​

typeText(text): Promise<void>

Defined in: packages/core/dist/index.d.mts:1274

Type text into the component as real per-character keystrokes, inserting at the current caret without clearing. See Interactor.typeText.

Parameters​
text​

string

The literal text to type, one keystroke per character

Returns​

Promise<void>

Inherited from​

PopoverDriver.typeText


waitForClose()​

waitForClose(timeoutMs?): Promise<boolean>

Defined in: packages/component-driver-radix-v1/src/components/PopoverDriver.ts:107

Wait for the popover to close (its content to unmount).

Parameters​
timeoutMs?​

number = defaultTransitionDuration

Returns​

Promise<boolean>

Inherited from​

PopoverDriver.waitForClose


waitForOpen()​

waitForOpen(timeoutMs?): Promise<boolean>

Defined in: packages/component-driver-radix-v1/src/components/PopoverDriver.ts:97

Wait for the popover to open (its content to mount).

Parameters​
timeoutMs?​

number = defaultTransitionDuration

Returns​

Promise<boolean>

Inherited from​

PopoverDriver.waitForOpen


waitUntil()​

waitUntil<T>(option): Promise<T>

Defined in: packages/core/dist/index.d.mts:1356

Type Parameters​
T​

T

Parameters​
option​

WaitUntilOption<T>

Returns​

Promise<T>

Inherited from​

PopoverDriver.waitUntil


waitUntilComponentState()​

waitUntilComponentState(option?): Promise<void>

Defined in: packages/core/dist/index.d.mts:1355

Wait until the component is in the expected state such as the component's visibility or existence. If the component has not reached the expected state within the timeout, it will throw an error.

By default it waits until the component is attached to the DOM within 30 seconds.

Parameters​
option?​

Partial<Readonly<WaitForOption>>

The option to configure the wait behavior

Returns​

Promise<void>

Inherited from​

PopoverDriver.waitUntilComponentState


waitUntilVisible()​

waitUntilVisible(timeoutMs?): Promise<void>

Defined in: packages/core/dist/index.d.mts:1343

Wait until the component is attached and becomes visible to the DOM.

Parameters​
timeoutMs?​

number

The number of milliseconds to wait before timing out. Defaults to defaultWaitForOption.timeoutMs so this wait shares a single flake-tolerance source with waitUntilComponentState (#1057).

Returns​

Promise<void>

Inherited from​

PopoverDriver.waitUntilVisible


overriddenParentLocator()​

static overriddenParentLocator(): Optional<PartLocator>

Defined in: packages/core/dist/index.d.mts:1211

Portal hook: where to re-root this driver's locator when its component renders outside the parent's DOM (a modal, popup, drawer). Return the PartLocator that locates the component from the document root, or undefined (the default) for normal in-tree components whose locator chains from the parent.

This is static because it is per-class metadata read off the constructor before any instance exists — which makes the "no instance state" constraint structural rather than a documented caution. Override with static override.

Returns​

Optional<PartLocator>

Inherited from​

PopoverDriver.overriddenParentLocator


overrideLocatorRelativePosition()​

static overrideLocatorRelativePosition(): Optional<LocatorRelativePosition>

Defined in: packages/core/dist/index.d.mts:1221

Portal hook: the locator relative position to apply when the component's real DOM is a sibling/elsewhere rather than a descendant (e.g. a MUI dialog rendered at the document root, located by a "Same"-level selector). Return undefined (the default) to keep the natural position declared by the ScenePart.

Static for the same reason as ComponentDriver.overriddenParentLocator: it is class-level metadata read before construction. Override with static override.

Returns​

Optional<LocatorRelativePosition>

Inherited from​

PopoverDriver.overrideLocatorRelativePosition

Protected members (19)

Properties​

triggerLocator​

protected readonly triggerLocator: PartLocator

Defined in: packages/component-driver-radix-v1/src/components/PopoverDriver.ts:44

The scene-supplied trigger locator — also the anchor subclasses (e.g. ComboboxDriver) read trigger-side state from.

Inherited from​

PopoverDriver.triggerLocator

Accessors​

inputLocator​

Get Signature​

get protected inputLocator(): PartLocator

Defined in: packages/component-driver-radix-v1/src/components/ComboboxDriver.ts:77

The cmdk filter input inside the open panel.

Returns​

PartLocator


listLocator​

Get Signature​

get protected listLocator(): PartLocator

Defined in: packages/component-driver-radix-v1/src/components/ComboboxDriver.ts:88

The DIRECT parent of the option items. cmdk renders items under [cmdk-list] > [cmdk-list-sizer] (an internal measuring wrapper), but the sizer is undocumented; anchoring iteration at the documented [cmdk-list] and letting childListHelper descend through wrappers keeps the driver on cmdk's public surface only.

Returns​

PartLocator

Methods​

activate()​

protected activate(): Promise<void>

Defined in: packages/core/dist/index.d.mts:1282

Activate the component without relying on pointer geometry. See Interactor.activate.

Returns​

Promise<void>

Inherited from​

PopoverDriver.activate


contextMenu()​

protected contextMenu(): Promise<void>

Defined in: packages/core/dist/index.d.mts:1278

Dispatch a right-click / contextmenu event on the component. See Interactor.contextMenu.

Returns​

Promise<void>

Inherited from​

PopoverDriver.contextMenu


drag()​

protected drag(delta): Promise<void>

Defined in: packages/core/dist/index.d.mts:1320

Drag this component by the given pixel delta from its center. See Interactor.drag.

Prefer a keyboard-driven setValue over a true drag in real drivers — these drag primitives exist only for cases keyboard cannot express (e.g. panning a Lightbox, reordering a column). jsdom has no layout engine, so the positional outcome of the drag is E2E-only there.

Parameters​
delta​

Point

Pixel offset to drag by

Returns​

Promise<void>

Inherited from​

PopoverDriver.drag


dragTo()​

protected dragTo(target): Promise<void>

Defined in: packages/core/dist/index.d.mts:1309

Drag this component and drop it onto another component. See Interactor.dragTo.

Prefer a keyboard-driven setValue over a true drag in real drivers — these drag primitives exist only for cases keyboard cannot express (e.g. panning a Lightbox, reordering a column). jsdom has no layout engine, so the positional outcome of the drag is E2E-only there.

Parameters​
target​

ComponentDriver<any>

Another driver whose root element is the drop target

Returns​

Promise<void>

Inherited from​

PopoverDriver.dragTo


enforcePartExistence()​

protected enforcePartExistence(partName): Promise<void>

Defined in: packages/core/dist/index.d.mts:1235

Check the specified parts' existences, and throw MissingPartError if any of the part is found not existence. Existence is defined by the part's existence in the DOM regardless of its visibility on the screen

Parameters​
partName​

readonly never[]

Single or array of the names of the parts to be enforced

Returns​

Promise<void>

Inherited from​

PopoverDriver.enforcePartExistence


getBoundingRect()​

protected getBoundingRect(): Promise<BoundingRect>

Defined in: packages/core/dist/index.d.mts:1327

Get this component's bounding rectangle. See Interactor.getBoundingRect.

jsdom has no layout engine, so every coordinate and dimension is 0 there; real geometry is E2E-only.

Returns​

Promise<BoundingRect>

Inherited from​

PopoverDriver.getBoundingRect


getMissingPartNames()​

protected getMissingPartNames(partName): Promise<readonly never[]>

Defined in: packages/core/dist/index.d.mts:1241

Get the names of parts not in the DOM

Parameters​
partName​

readonly never[]

Single or array of the names of the parts to be examined

Returns​

Promise<readonly never[]>

Inherited from​

PopoverDriver.getMissingPartNames


innerHTML()​

protected innerHTML(): Promise<string>

Defined in: packages/core/dist/index.d.mts:1361

Get the inner HTML of the component

Returns​

Promise<string>

The inner HTML of the component

Inherited from​

PopoverDriver.innerHTML


mouseDown()​

protected mouseDown(option?): Promise<void>

Defined in: packages/core/dist/index.d.mts:1256

Parameters​
option?​

Partial<MouseDownOption>

Returns​

Promise<void>

Inherited from​

PopoverDriver.mouseDown


mouseEnter()​

protected mouseEnter(option?): Promise<void>

Defined in: packages/core/dist/index.d.mts:1260

Parameters​
option?​

Partial<MouseEnterOption>

Returns​

Promise<void>

Inherited from​

PopoverDriver.mouseEnter


mouseLeave()​

protected mouseLeave(option?): Promise<void>

Defined in: packages/core/dist/index.d.mts:1261

Parameters​
option?​

Partial<MouseLeaveOption>

Returns​

Promise<void>

Inherited from​

PopoverDriver.mouseLeave


mouseMove()​

protected mouseMove(option?): Promise<void>

Defined in: packages/core/dist/index.d.mts:1255

Parameters​
option?​

Partial<MouseMoveOption>

Returns​

Promise<void>

Inherited from​

PopoverDriver.mouseMove


mouseOut()​

protected mouseOut(option?): Promise<void>

Defined in: packages/core/dist/index.d.mts:1259

Parameters​
option?​

Partial<MouseOutOption>

Returns​

Promise<void>

Inherited from​

PopoverDriver.mouseOut


mouseOver()​

protected mouseOver(option?): Promise<void>

Defined in: packages/core/dist/index.d.mts:1258

Parameters​
option?​

Partial<HoverOption>

Returns​

Promise<void>

Inherited from​

PopoverDriver.mouseOver


mouseUp()​

protected mouseUp(option?): Promise<void>

Defined in: packages/core/dist/index.d.mts:1257

Parameters​
option?​

Partial<MouseUpOption>

Returns​

Promise<void>

Inherited from​

PopoverDriver.mouseUp


scrollBy()​

protected scrollBy(delta): Promise<void>

Defined in: packages/core/dist/index.d.mts:1298

Scroll the component by the given pixel delta. See Interactor.scrollBy.

jsdom has no layout engine, so the scroll is a no-op there and behavioral assertions (resulting offset) are E2E-only.

Parameters​
delta​

Point

Pixel offset to scroll by

Returns​

Promise<void>

Inherited from​

PopoverDriver.scrollBy