Skip to content

DataTable: Add outline-offset to DataTable pagination buttons #6055

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

Merged
merged 2 commits into from
May 23, 2025

Conversation

TylerJDev
Copy link
Member

@TylerJDev TylerJDev commented May 16, 2025

Context: https://github.com/github/accessibility-audits/issues/11135

Adds outline offset to focus outline on pagination buttons in DataTable.

Before:

DataTable with first button in pagination focused; the focus outline blends in with the button's background color

After:

DataTable with first button in pagination focused; the focus outline is slightly offset from the button

Changelog

Changed

  • Adds outline-offset to pagination buttons

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

@TylerJDev TylerJDev requested review from joshblack and Copilot May 16, 2025 14:21
@TylerJDev TylerJDev requested a review from a team as a code owner May 16, 2025 14:21
Copy link

changeset-bot bot commented May 16, 2025

🦋 Changeset detected

Latest commit: ef5ef1f

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

@github-actions github-actions bot added staff Author is a staff member integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels May 16, 2025
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 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

Adds an outline-offset and matching focus-visible styles to the active pagination button in the DataTable component to improve keyboard focus visibility.

  • Introduces a new focus-visible style block for .TablePaginationPage[data-active='true']
  • Uses CSS variables for outline color and box-shadow to match existing accent tokens
Comments suppressed due to low confidence (2)

packages/react/src/DataTable/Pagination.tsx:92

  • [nitpick] The CSS variable --bgColor-accent-emphasis is inconsistent with the existing naming pattern (--fgColor-onEmphasis). Consider unifying to match your theme’s token naming conventions or use get() to retrieve the same token.
outline: 2px solid var(--bgColor-accent-emphasis);

packages/react/src/DataTable/Pagination.tsx:91

  • We don’t have existing tests covering keyboard focus visuals on pagination buttons. Consider adding a snapshot or visual regression test to ensure the new focus-visible styles render correctly.
.TablePaginationPage[data-active='true']:focus-visible {

}

.TablePaginationPage[data-active='true'] {
background-color: ${get('colors.accent.emphasis')};
color: ${get('colors.fg.onEmphasis')};
}

.TablePaginationPage[data-active='true']:focus-visible {
outline: 2px solid var(--bgColor-accent-emphasis);
outline-offset: -2px;
Copy link
Preview

Copilot AI May 16, 2025

Choose a reason for hiding this comment

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

A negative outline-offset will draw the outline inside the element’s border, which can reduce visible separation. Consider using a positive offset (e.g., 2px) to push the outline outward for better visibility.

Suggested change
outline-offset: -2px;
outline-offset: 2px;

Copilot uses AI. Check for mistakes.

Copy link
Contributor

github-actions bot commented May 16, 2025

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 96.14 KB (0%)
packages/react/dist/browser.umd.js 96.48 KB (0%)

@joshblack joshblack requested a review from mperrotti May 16, 2025 15:15
@TylerJDev TylerJDev added this pull request to the merge queue May 23, 2025
Merged via the queue into main with commit 3b6b1d1 May 23, 2025
36 checks passed
@TylerJDev TylerJDev deleted the tylerjdev/add-outline-offset-datatable-pagination branch May 23, 2025 15:08
@primer primer bot mentioned this pull request May 23, 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 staff Author is a staff member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants