Skip to content

Commit 37f4607

Browse files
committed
combobox: add additional data attributes to wrapper + popover
1 parent 85e6e76 commit 37f4607

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/combobox/src/index.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,8 @@ export const Combobox = React.forwardRef(
317317

318318
let id = useId(props.id);
319319
let listboxId = id ? makeId("listbox", id) : "listbox";
320-
321320
let isControlledRef = React.useRef<boolean>(false);
321+
let isExpanded = popoverIsExpanded(state);
322322

323323
let context: InternalComboboxContextValue = {
324324
ariaLabel,
@@ -328,7 +328,7 @@ export const Combobox = React.forwardRef(
328328
comboboxId: id,
329329
data,
330330
inputRef,
331-
isExpanded: popoverIsExpanded(state),
331+
isExpanded,
332332
listboxId,
333333
onSelect: onSelect || noop,
334334
openOnFocus,
@@ -352,12 +352,13 @@ export const Combobox = React.forwardRef(
352352
{...props}
353353
data-reach-combobox=""
354354
data-state={getDataState(state)}
355+
data-expanded={isExpanded || undefined}
355356
ref={forwardedRef}
356357
>
357358
{isFunction(children)
358359
? children({
359360
id,
360-
isExpanded: popoverIsExpanded(state),
361+
isExpanded,
361362
navigationValue: data.navigationValue ?? null,
362363
state,
363364
})
@@ -684,6 +685,7 @@ export const ComboboxPopover = React.forwardRef(
684685
as={Comp}
685686
{...props}
686687
ref={ref}
688+
data-expanded={isExpanded || undefined}
687689
position={position}
688690
targetRef={inputRef}
689691
{...sharedProps}

0 commit comments

Comments
 (0)