-
Notifications
You must be signed in to change notification settings - Fork 641
Make Button/LinkButton 'link' variant respect user underline preference
#7102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 23090f2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
|
Uh oh! @mperrotti, at least one image you shared is missing helpful alt text. Check your pull request body to fix the following violations:
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.
|
|
👋 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! |
There was a problem hiding this 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-underlinesattribute - 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' || |
Copilot
AI
Oct 30, 2025
There was a problem hiding this comment.
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.
| context.id !== 'components-link-dev--inline' || | |
| context.id !== 'components-link-dev--inline' && |
There was a problem hiding this comment.
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>
Button/LinkButton 'link' variant respect user underline preference
|
Had to update Banner VRT snapshots because Banner uses |
Closes https://github.com/github/primer/issues/5948
Demo
Before
After
Changelog
New
Changed
<Button variant="link">and<LinkButton variant="link">will always show an underline if the user has the a11y underlines preference onRemoved
Rollout strategy
Testing & Reviewing
Merge checklist