Skip to content

Commit

Permalink
update aria-properties to ensure correct label is passed into ListBox
Browse files Browse the repository at this point in the history
  • Loading branch information
mcwinter07 committed Sep 20, 2024
1 parent c29094e commit 4a9885d
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions packages/components/src/Filter/FilterSelect/FilterSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ export const FilterSelect = <Option extends SelectOption = SelectOption>({
)

const { buttonProps } = useButton(triggerProps, triggerRef)

const renderTriggerButtonProps = {
...buttonProps,
"aria-labelledBy": undefined,
"aria-controls": menuProps.id,
}
return (
<>
<HiddenSelect label={label} state={state} triggerRef={triggerRef} />
Expand All @@ -90,19 +94,24 @@ export const FilterSelect = <Option extends SelectOption = SelectOption>({
selectedValue: state.selectedItem?.textValue || undefined,
label,
isOpen,
...buttonProps,
...renderTriggerButtonProps,
})
}
onMount={setTriggerRef}
classNameOverride={classNameOverride}
>
<FilterContents classNameOverride={styles.filterContents}>
<SelectProvider<Option> state={state}>
<SelectPopoverContents menuProps={menuProps}>
{children}
</SelectPopoverContents>
</SelectProvider>
</FilterContents>
<>
{/* <VisuallyHidden id={menuProps.id}>{label}</VisuallyHidden> */}
<FilterContents classNameOverride={styles.filterContents}>
<SelectProvider<Option> state={state}>
<SelectPopoverContents
menuProps={{ ...menuProps, "aria-labelledby": buttonProps.id }}
>
{children}
</SelectPopoverContents>
</SelectProvider>
</FilterContents>
</>
</Filter>
</>
)
Expand Down

0 comments on commit 4a9885d

Please sign in to comment.