Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(SelectPanel): pass anchorId to AnchoredOverlay #5549

Merged
merged 9 commits into from
Jan 23, 2025
5 changes: 5 additions & 0 deletions .changeset/tricky-ducks-pretend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": patch
---

fix(SelectPanel): pass anchorId to AnchoredOverlay
Original file line number Diff line number Diff line change
Expand Up @@ -314,18 +314,19 @@ export const WithSelectPanel = () => {

return (
<FormControl required>
<FormControl.Label>Select Labels</FormControl.Label>
<FormControl.Label id="select_panel_label">Select Labels</FormControl.Label>
<SelectPanel
title="Select labels"
subtitle="Use labels to organize issues and pull requests"
renderAnchor={({children, 'aria-labelledby': ariaLabelledBy, ...anchorProps}) => (
renderAnchor={({children, id, ...anchorProps}) => (
<Button
trailingAction={TriangleDownIcon}
aria-labelledby={` ${ariaLabelledBy}`}
aria-labelledby={`select_panel_label selectpanel_wrapper`}
id={id}
{...anchorProps}
aria-haspopup="dialog"
>
{children ?? 'Select Labels'}
<span id="selectpanel_wrapper">{children ?? 'Select Labels'}</span>
</Button>
)}
open={open}
Expand Down
2 changes: 2 additions & 0 deletions packages/react/src/SelectPanel/SelectPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export function SelectPanel({
overlayProps,
sx,
className,
id,
...listProps
}: SelectPanelProps): JSX.Element {
const titleId = useId()
Expand Down Expand Up @@ -213,6 +214,7 @@ export function SelectPanel({
}}
focusTrapSettings={focusTrapSettings}
focusZoneSettings={focusZoneSettings}
anchorId={id}
>
<LiveRegionOutlet />
{usingModernActionList ? null : (
Expand Down
Loading