Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/ten-schools-provide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@primer/react': patch
---

SelectPanel anchors should have aria-haspopup="listbox"

<!-- Changed components: SelectPanel -->
7 changes: 6 additions & 1 deletion src/SelectPanel/SelectPanel.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ export const Default = () => {
title="Select labels"
subtitle="Use labels to organize issues and pull requests"
renderAnchor={({children, 'aria-labelledby': ariaLabelledBy, ...anchorProps}) => (
<Button trailingAction={TriangleDownIcon} aria-labelledby={` ${ariaLabelledBy}`} {...anchorProps}>
<Button
trailingAction={TriangleDownIcon}
aria-labelledby={` ${ariaLabelledBy}`}
{...anchorProps}
aria-haspopup="listbox"
>
Comment on lines +57 to +62

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<Button
trailingAction={TriangleDownIcon}
aria-labelledby={` ${ariaLabelledBy}`}
{...anchorProps}
aria-haspopup="listbox"
>
<Button
trailingAction={TriangleDownIcon}
aria-labelledby={` ${ariaLabelledBy}`}
aria-haspopup="dialog"
{...anchorProps}
>

@electron97 electron97 Aug 25, 2023

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @joshblack,

The order which you suggested will not work

aria-haspopup="dialog"
{...anchorProps}

because first it will take the value of aria-haspopup to dialog then it will overwrite the value with true from anchorProps. So to fix that we need first pass anchorProps and then dialog.

{...anchorProps}
aria-haspopup="dialog"

Please let me know if you have any questions.
I have updated the screenshots in the PR description with the current changes.

Also I found something while testing the changes locally that the same issue still exists in SelectPanel.features.stories.tsx. Please let me know if should we fix this issue in this PR as well or open a completely new issue.

Thanks!

{children ?? 'Select Labels'}
</Button>
)}
Expand Down