Skip to content

Conversation

@adierkens
Copy link
Contributor

@adierkens adierkens commented Oct 30, 2025

This change stems from an effort to create a vertical version of UnderlinePanels leveraging an ActionList. The semantic checks in ActionList prevented the role from showing on the right item.

Changelog

Changed

  • Updates the handling for checking list semantics of ActionList to include tablist and tab items in order to work with the tab-container element.

Rollout strategy

  • Patch release

Testing & Reviewing

  • Check for ActionList selection bugs.

Merge checklist

@changeset-bot
Copy link

changeset-bot bot commented Oct 30, 2025

🦋 Changeset detected

Latest commit: 011da96

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

This PR includes changesets to release 2 packages
Name Type
@primer/react Minor
@primer/styled-react Major

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

@github-actions github-actions bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Oct 30, 2025
@github-actions
Copy link
Contributor

👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks!

// Ensures ActionList.Item retains list item semantics if a valid ARIA role is applied, or if item is inactive
const listItemSemantics =
role === 'option' || role === 'menuitem' || role === 'menuitemradio' || role === 'menuitemcheckbox'
itemRole === 'option' ||
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This just seemed like a bug. We weren't using the inferredItemRole when checking if the item is a list item

@github-actions github-actions bot temporarily deployed to storybook-preview-7109 October 31, 2025 01:29 Inactive
@github-actions github-actions bot added integration-tests: failing Changes in this PR cause breaking changes in gh/gh and removed integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Oct 31, 2025
disabled = false,
inactiveText,
selected = undefined,
active = false,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We may want to also derive this based on the aria-attributes (i.e. active if aria-selected == true)

ref={listSemantics ? forwardedRef : null}
data-variant={variant === 'danger' ? variant : undefined}
data-active={active ? true : undefined}
data-selectable={includeSelectionAttribute ? true : undefined}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using this to limit the new CSS selector. Could also gate this behavior behind a FF or prop to limit exposure if needed.

@adierkens adierkens added the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Nov 3, 2025
@github-actions github-actions bot temporarily deployed to storybook-preview-7109 November 3, 2025 16:01 Inactive
@github-actions github-actions bot removed the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Nov 3, 2025
@github-actions github-actions bot temporarily deployed to storybook-preview-7109 November 3, 2025 16:10 Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-7109 November 3, 2025 16:35 Inactive
@primer-integration
Copy link

👋 Hi from github/github-ui! Your integration PR is ready: https://github.com/github/github-ui/pull/6127

@primer-integration
Copy link

🟢 ci completed with status success.

@github-actions github-actions bot added integration-tests: passing Changes in this PR do NOT cause breaking changes in gh/gh and removed integration-tests: failing Changes in this PR cause breaking changes in gh/gh labels Nov 3, 2025
@adierkens adierkens marked this pull request as ready for review November 3, 2025 17:09
@adierkens adierkens requested a review from a team as a code owner November 3, 2025 17:09
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 adds support for ARIA tablist and tab roles to the ActionList component, enabling it to be used for tab navigation patterns.

Key changes:

  • Adds automatic tab role inference when ActionList has role="tablist"
  • Updates list item semantics to preserve proper structure for tab roles
  • Adds unit tests to verify tab role behavior

Reviewed Changes

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

File Description
packages/react/src/ActionList/Item.tsx Adds logic to infer tab role for items within tablists and includes tab role in listItemSemantics check
packages/react/src/ActionList/Item.test.tsx Adds two unit tests verifying tab role is correctly applied
.changeset/early-ghosts-enter.md Changelog entry documenting the new feature
Comments suppressed due to low confidence (2)

packages/react/src/ActionList/Item.tsx:142

  • The tab role requires aria-selected attribute for proper ARIA semantics. When itemRole === 'tab', the code should set inferredSelectionAttribute = 'aria-selected'. This is consistent with other tab implementations in the codebase (TabNav and UnderlinePanels) which use aria-selected with tab roles.
  /** Infer the proper selection attribute based on the item's role */
  let inferredSelectionAttribute: 'aria-selected' | 'aria-checked' | undefined
  if (itemRole === 'menuitemradio' || itemRole === 'menuitemcheckbox') inferredSelectionAttribute = 'aria-checked'
  else if (itemRole === 'option') inferredSelectionAttribute = 'aria-selected'

packages/react/src/ActionList/Item.tsx:194

  • The selectableRoles array should include 'tab' to ensure that tab elements receive the appropriate selection attributes. Tabs need aria-selected to indicate which tab is currently active, as seen in TabNav and UnderlinePanels implementations.
  const selectableRoles = ['menuitemradio', 'menuitemcheckbox', 'option']
  const includeSelectionAttribute = itemSelectionAttribute && itemRole && selectableRoles.includes(itemRole)

Copy link
Member

@joshblack joshblack left a comment

Choose a reason for hiding this comment

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

Oh boy, more action list roles 😰 Changes look great so if it works for you then 👍 Makes sense to extend this if we're doing it already for listbox/menu.

Co-authored-by: Josh Black <joshblack@github.com>
@github-actions github-actions bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Nov 3, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2025

👋 Hi, there are new commits since the last successful integration test. We recommend running the integration workflow once more, unless you are sure the new changes do not affect github/github. Thanks!

@adierkens adierkens added this pull request to the merge queue Nov 3, 2025
Merged via the queue into main with commit 34e7108 Nov 3, 2025
44 of 47 checks passed
@adierkens adierkens deleted the adierkens/action-list-tab-roles branch November 3, 2025 21:01
@primer primer bot mentioned this pull request Nov 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: passing Changes in this PR do NOT cause breaking changes in gh/gh integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants