Skip to content

Conversation

@liuliu-dev
Copy link
Contributor

What are you trying to accomplish?

Ensures that ActionList items with role="option" (i.e., items in a listbox) always use aria-selected instead of aria-checked.

Related issue: https://github.com/github/accessibility-audits/issues/14576

My previous fix in #3875 addressed the double announcement issue ("not selected not checked") for SelectPanel by changing aria_selection_variant to always use :selected. It only applies when using SelectPanel::ItemList.

This follow-up fix enforces correct ARIA semantics at the ActionList::Item level by checking if the parent list has role="listbox". Per WAI-ARIA 1.2 specification, the option role requires aria-selected as its selection state,aria-checked is only a supported attribute, not the primary selection indicator.

Integration

Risk Assessment

  • Low risk the change is small, highly observable, and easily rolled back.
  • Medium risk changes that are isolated, reduced in scope or could impact few users. The change will not impact library availability.
  • High risk changes are those that could impact customers and SLOs, low or no test coverage, low observability, or slow to rollback.

What approach did you choose and why?

Anything you want to highlight for special attention from reviewers?

Accessibility

  • Fixes axe scan violation - This change fixes an existing axe scan violation.
  • No new axe scan violation - This change does not introduce any new axe scan violations.
  • New axe violation - This change introduces a new axe scan violation. Please describe why the violation cannot be resolved below.

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Added/updated previews (Lookbook)
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.

@changeset-bot
Copy link

changeset-bot bot commented Jan 27, 2026

🦋 Changeset detected

Latest commit: a828f8e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/view-components Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes an accessibility issue where ActionList items with role="option" (i.e., items in a listbox) were not consistently using aria-selected as required by the WAI-ARIA 1.2 specification. This is a follow-up to PR #3875, which addressed the issue for SelectPanel specifically, but this fix applies it more broadly at the ActionList::Item level.

Changes:

  • Modified ActionList::Item to automatically use aria-selected when the parent list has role="listbox", regardless of the aria_selection_variant setting
  • Added a changeset documenting this accessibility fix

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
app/components/primer/alpha/action_list/item.rb Updated logic to enforce aria-selected for listbox items per WAI-ARIA spec
.changeset/slick-walls-retire.md Added changeset documenting the fix

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@liuliu-dev liuliu-dev added this pull request to the merge queue Jan 29, 2026
Merged via the queue into main with commit 024dc7e Jan 29, 2026
44 of 45 checks passed
@liuliu-dev liuliu-dev deleted the liuliu/always-use-aria-selected-for-actionlist-items-with-role-option branch January 29, 2026 18:25
@primer primer bot mentioned this pull request Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants