Skip to content

Conversation

@mperrotti
Copy link
Contributor

@mperrotti mperrotti commented Oct 30, 2025

Closes https://github.com/github/primer/issues/5948

Demo

Before

Screenshot 2025-10-30 at 12 03 59 PM

After

Screenshot 2025-10-30 at 11 50 19 AM

Changelog

New

Changed

  • <Button variant="link"> and <LinkButton variant="link"> will always show an underline if the user has the a11y underlines preference on

Removed

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

Merge checklist

@mperrotti mperrotti requested a review from a team as a code owner October 30, 2025 15:54
@changeset-bot
Copy link

changeset-bot bot commented Oct 30, 2025

🦋 Changeset detected

Latest commit: 23090f2

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 Patch
@primer/styled-react 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

@github-actions
Copy link
Contributor

github-actions bot commented Oct 30, 2025

Uh oh! @mperrotti, at least one image you shared is missing helpful alt text. Check your pull request body to fix the following violations:

  • Images should have meaningful alternative text (alt text) at line 9
  • Images should have meaningful alternative text (alt text) at line 13

Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image.

Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.

🤖 Beep boop! This comment was added automatically by github/accessibility-alt-text-bot.

@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!

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 accessibility link underline preferences to the Button component's link variant. The changes allow link-styled buttons to respect a data-a11y-link-underlines attribute for showing or hiding underlines.

  • Adds CSS rules to control underlines on link variant buttons based on data-a11y-link-underlines attribute
  • Creates a new dev story to demonstrate the underline preference functionality
  • Updates e2e tests to include the new story for visual regression testing

Reviewed Changes

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

File Description
packages/react/src/Button/ButtonBase.module.css Adds CSS rules for link variant underline control based on accessibility preference, including special handling for buttons with visual icons
packages/react/src/Button/Button.dev.stories.tsx Adds dev story demonstrating link variant with underline preference enabled/disabled
packages/react/.storybook/preview.jsx Updates decorator logic to exclude new story from default underline behavior
e2e/components/Button.test.ts Registers new story for e2e testing

// Set data-a11y-link-underlines=true to enable underlines in all stories except the Link dev Inline Story.
let wrapperProps =
context.id !== 'components-link-dev--inline'
context.id !== 'components-link-dev--inline' ||
Copy link

Copilot AI Oct 30, 2025

Choose a reason for hiding this comment

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

Incorrect logical operator: using || (OR) makes the condition always true. This should be && (AND) to exclude both stories from the default underline behavior. With OR, any context.id will satisfy at least one condition.

Suggested change
context.id !== 'components-link-dev--inline' ||
context.id !== 'components-link-dev--inline' &&

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think this is accurate...

Human reviewers - what do you think?

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@mperrotti mperrotti changed the title updates Button 'link' variant to respect user's underline preference Make Button/LinkButton 'link' variant respect user underline preference Oct 30, 2025
@github-actions github-actions bot requested a deployment to storybook-preview-7102 October 30, 2025 16:11 Abandoned
@github-actions github-actions bot temporarily deployed to storybook-preview-7102 October 30, 2025 16:19 Inactive
@mperrotti mperrotti added the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Oct 30, 2025
@mperrotti
Copy link
Contributor Author

Had to update Banner VRT snapshots because Banner uses <Button variant="link">

@primer primer bot requested a review from a team as a code owner October 30, 2025 17:36
@primer primer bot requested a review from langermank October 30, 2025 17:36
@github-actions github-actions bot removed the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Oct 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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