Skip to content

fix: adjust button keybinding hint spacing - #8833

Open
SimonGebru wants to merge 2 commits into
primer:mainfrom
SimonGebru:perf/8724-button-keybinding
Open

SimonGebru wants to merge 2 commits into
primer:mainfrom
SimonGebru:perf/8724-button-keybinding

Conversation

@SimonGebru

Copy link
Copy Markdown

Closes #8724

Changelog

New

  • Added a regression test to verify that only the last keybinding hint in a sequence receives the adjusted margin.

Changed

  • Preserved the default button padding and adjusted the last keybinding hint within trailingVisual using a calculated negative margin.
  • Hints outside trailingVisual, such as those in the label or alongside a trailingAction, now use the normal button padding. These buttons may be 6px wider (8px for large buttons), as discussed in the issue.

Removed

  • Removed the previous :has()-based padding overrides.

Rollout strategy

  • Not sure

Testing & Reviewing

  • Verified keybinding hint spacing across small, medium, and large buttons.
  • Confirmed that only the last chord in a sequence receives the negative margin.
  • Checked the visual appearance in Chrome, Safari, and Firefox.
  • All 235 Button Playwright tests passed in Docker, and the new regression test passed locally.

@SimonGebru
SimonGebru requested a review from a team as a code owner November 24, 2026 10:43
@changeset-bot

changeset-bot Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3f27995

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

This PR includes changesets to release 1 package
Name Type
@primer/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

Adjusts the spacing of the button keybinding hints for better visibility.
@SimonGebru

Copy link
Copy Markdown
Author

I noticed that the Deploy Preview (fork) workflow failed during the AAT checks.

Looking at the logs, the failures appear to be environment-related. Playwright encounters net::ERR_CONNECTION_REFUSED when trying to access Storybook at 172.17.0.1:6006. The failures involve SelectPanel stories rather than the Button component changed in this PR.

I don't have permission to re-run the workflow. Could a maintainer re-run the failed jobs when convenient?

This branch was successfully deployed

1 active deployment
github-pages — 3f27995e Deployed Nov 24, 2026 by SimonGebru via deploy-preview #30835
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Button: replace :has([data-kbd-chord]) with a data attribute set from React

1 participant