Skip to content

Commit

Permalink
combobox: add additional data attributes to wrapper + popover
Browse files Browse the repository at this point in the history
  • Loading branch information
chaance committed Dec 6, 2021
1 parent 85e6e76 commit 37f4607
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/combobox/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ export const Combobox = React.forwardRef(

let id = useId(props.id);
let listboxId = id ? makeId("listbox", id) : "listbox";

let isControlledRef = React.useRef<boolean>(false);
let isExpanded = popoverIsExpanded(state);

let context: InternalComboboxContextValue = {
ariaLabel,
Expand All @@ -328,7 +328,7 @@ export const Combobox = React.forwardRef(
comboboxId: id,
data,
inputRef,
isExpanded: popoverIsExpanded(state),
isExpanded,
listboxId,
onSelect: onSelect || noop,
openOnFocus,
Expand All @@ -352,12 +352,13 @@ export const Combobox = React.forwardRef(
{...props}
data-reach-combobox=""
data-state={getDataState(state)}
data-expanded={isExpanded || undefined}
ref={forwardedRef}
>
{isFunction(children)
? children({
id,
isExpanded: popoverIsExpanded(state),
isExpanded,
navigationValue: data.navigationValue ?? null,
state,
})
Expand Down Expand Up @@ -684,6 +685,7 @@ export const ComboboxPopover = React.forwardRef(
as={Comp}
{...props}
ref={ref}
data-expanded={isExpanded || undefined}
position={position}
targetRef={inputRef}
{...sharedProps}
Expand Down

0 comments on commit 37f4607

Please sign in to comment.