Skip to content

Commit 024dc7e

Browse files
authored
Fix: Always use aria-selected for ActionList items with role="option" (#3893)
1 parent 4e702c8 commit 024dc7e

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

.changeset/slick-walls-retire.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/view-components': patch
3+
---
4+
5+
Always use `aria-selected` for ActionList items with role="option".

app/components/primer/alpha/action_list/item.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,8 @@ def before_render
302302
if @list.allows_selection?
303303
@content_arguments[:aria] = merge_aria(
304304
@content_arguments,
305-
{ aria: @list.aria_selection_variant == :selected ? { selected: active? } : { checked: active? } }
305+
# Always use aria-selected for listbox (role="option" requires aria-selected per WAI-ARIA 1.2)
306+
{ aria: @list.acts_as_listbox? || @list.aria_selection_variant == :selected ? { selected: active? } : { checked: active? } }
306307
)
307308
end
308309

0 commit comments

Comments
 (0)