Skip to content

feat(pager): align with Fusion DS#8010

Merged
nuria1110 merged 1 commit into
masterfrom
pager-audit
Jun 30, 2026
Merged

feat(pager): align with Fusion DS#8010
nuria1110 merged 1 commit into
masterfrom
pager-audit

Conversation

@nuria1110

Copy link
Copy Markdown
Contributor

Proposed behaviour

Alignes Pager to Fusion DS Pagination component.

  • Updates styles and adds fusion-tokens.
  • Replaces navigation links with buttons.
  • Updates translation keys and deprecates keys that are no longer relevant.
  • Adds accessible labels for navigation landmark, current page input and navigation buttons.
  • Adds size prop:
image image image

Deprecated props:

  • hideDisabledElements
  • showPageSizeLabelBefore
  • showPageSizeLabelAfter
  • showTotalRecords
  • showPreviousAndNextButtons
  • showPageCount
  • smallScreenBreakpoint

Current behaviour

Pager is not aligned with Fusion DS.

Checklist

  • Commits follow our style guide
  • Related issues linked in commit messages if required
  • Screenshots are included in the PR if useful
  • All themes are supported if required
  • Unit tests added or updated if required
  • Playwright automation tests added or updated if required
  • Storybook added or updated if required
  • Translations added or updated (including creating or amending translation keys table in storybook) if required
  • Typescript d.ts file added or updated if required
  • Related docs have been updated if required

QA

  • Tested in provided StackBlitz sandbox/Storybook
  • Add new Playwright test coverage if required
  • Carbon implementation matches Design System/designs
  • UI Tests GitHub check reviewed if required

Additional context

Testing instructions

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Aligns the Pager component with Fusion DS Pagination, updating styling/tokens, interaction patterns, accessibility labels, and the public API surface (including a new size prop and deprecations of several legacy props/translation keys).

Changes:

  • Replaces link-based navigation with button-based navigation and introduces Fusion-aligned sizing/styling.
  • Updates i18n model: adds new aria/label keys and deprecates older pager translation keys.
  • Updates unit tests, Playwright tests, stories, and docs to match the new UI/behavior.

Reviewed changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/locales/locale.ts Updates pager locale typings, adds new keys and deprecates old ones.
src/locales/en-gb.ts Implements new pager translation keys for en-GB.
src/components/pager/pagination.style.ts Adds new Fusion-aligned pager styles (nav container + page size area).
src/components/pager/pagination.component.tsx Introduces new Pagination implementation (exported as Pager).
src/components/pager/internal/pagination-navigation.style.tsx Adds styling for navigation buttons and current page input layout.
src/components/pager/internal/pagination-navigation.component.tsx Implements button navigation + current-page input behavior and a11y.
src/components/pager/index.ts Switches default export to the new Pagination component and aliases props type.
src/components/pager/pager.test.tsx Reworks unit tests for the updated behavior and new aria-labels.
src/components/pager/pager.pw.tsx Updates/rewrites Playwright tests for focus management and a11y coverage.
src/components/pager/components.test-pw.tsx Updates Playwright mount component for the new Pager behavior.
src/components/pager/pager.stories.tsx Updates stories to reflect new API/behavior and adds size variants.
src/components/pager/pager-test.stories.tsx Updates test stories for broader visual/viewport coverage of new variants.
src/components/pager/pager.mdx Updates component docs and translation keys table.
src/components/pager/pager.component.tsx Removes the legacy Pager implementation.
src/components/pager/pager.style.ts Removes legacy Pager styling.
src/components/pager/internal/pager-navigation.component.tsx Removes legacy navigation implementation.
src/components/pager/internal/pager-navigation-link.component.tsx Removes legacy link-based navigation helper.
src/components/pager/internal/pager-navigation.test.tsx Removes legacy navigation tests.
src/components/flat-table/flat-table.style.ts Updates footer styling hooks to target the new pager root component.
src/components/flat-table/flat-table.test.tsx Updates Pager imports/usages in FlatTable tests.
src/components/flat-table/flat-table.pw.tsx Removes FlatTable pager-navigation Playwright tests tied to the old implementation.
src/internal/input/input.style.ts Removes legacy pager-specific input overrides hook.
src/internal/input/input-style-overrides.style.ts Deletes legacy pager input override CSS blocks.
src/internal/input-icon-toggle/input-icon-toggle.style.ts Removes pager-specific icon-toggle overrides.
skills/carbon-react/components/pager.md Updates skills docs for new Pager/Pagination API details.

Comment on lines +134 to +138
if (+totalRecords < 0 || Number.isNaN(+totalRecords)) {
return 1;
}
return Math.ceil(+totalRecords / internalPageSize);
}, [totalRecords, internalPageSize]);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

When totalRecords is 0, output is "0 of 0 pages" as the current page can never be larger than the total. This change is unnecessary.

Comment thread src/locales/locale.ts
Comment on lines +127 to +131
ariaLabel?: () => string;
// TODO - make the following keys required once deprecated keys are removed.
pageX: (currentPage?: number | string) => string;
ofTotalPages?: (totalPages: string | number) => string;
itemsPerPage?: () => string;

@nuria1110 nuria1110 Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Translations will be provided at a later date, consumers can set the translations themselves if necessary.

I have removed the deprecated translations that are no longer in use in all locales and added currentPage prop to translation key pageX.

Comment on lines +112 to 116
name: "pager.previousAriaLabel",
description:
"The text to display for the button that navigates to the last page of records",
"Accessible label for the 'Go To Next' button.",
type: "func",
returnType: "string",
Comment on lines 11 to 14
## Source
- Export: `./components/pager`
- Props interface: `PagerProps`
- Props interface: `PaginationProps`

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

.md files cannot be manually updated, I have reverted the interface name to PagerProps and added a TODO for this to be updated once the public interface it updated as a breaking change.

Comment thread src/components/pager/__internal__/pagination-navigation.component.tsx Outdated
DipperTheDan
DipperTheDan previously approved these changes Jun 15, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestions: Beware of conflicts with the FlatTable testing optimisation stuff @sianford is currently doing with FlatTable.

@nineteen88

Copy link
Copy Markdown
Contributor

This work will close the following issue as it will be superseded by this updated Pager/Pagination.

#7734

@nineteen88 nineteen88 self-requested a review June 17, 2026 09:08
nineteen88
nineteen88 previously approved these changes Jun 18, 2026
Comment thread src/locales/de-de.ts
previous: () => "Vorherige",
pageX: () => "Seite",
ofY: (count) => `von ${count}`,
pageX: (currentPage?: number | string) => `Seite ${currentPage}`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

comment: frustrating that we lose i18n support for this component again

Not a lot we can do about it, as it's not worth blocking while waiting for translations, but I wonder if this will cause issues for consuming teams

@nuria1110 nuria1110 marked this pull request as ready for review June 22, 2026 09:07
@nuria1110 nuria1110 requested review from a team as code owners June 22, 2026 09:07
@Silviota

Copy link
Copy Markdown

UXQA:

  • Rename "Pager" to "Pagination" to match industry standards.
  • In the Items per page control (M and L sizes), use hug content width. Reduce the spacing between the number and the caret, as it currently appears too wide.

@nuria1110 nuria1110 dismissed stale reviews from nineteen88 and DipperTheDan via 9363aa6 June 24, 2026 15:05
@nuria1110 nuria1110 marked this pull request as draft June 24, 2026 16:02
@divyajindel divyajindel marked this pull request as ready for review June 25, 2026 10:10
@divyajindel divyajindel marked this pull request as ready for review June 25, 2026 10:10
divyajindel
divyajindel previously approved these changes Jun 25, 2026
nineteen88
nineteen88 previously approved these changes Jun 30, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Warning

  • Copilot's review of this pull request may be incomplete because some of the changed files are excluded by your Copilot content exclusion settings. See Excluding content from Copilot for details.

Pull request overview

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

Files excluded by content exclusion policy (1)
  • skills/carbon-react/components/pager.md

Comment thread src/components/pager/pager.component.tsx
Comment thread src/components/flat-table/flat-table.test.tsx
divyajindel
divyajindel previously approved these changes Jun 30, 2026
Aligns to Pagination component in Fusion DS, Pager to be renamed to Pagination in a future release.
Deprecates props that are no longer relevant, updates styles with fusion-tokens and updates
translation keys.
@nuria1110 nuria1110 merged commit c87418b into master Jun 30, 2026
37 of 38 checks passed
@nuria1110 nuria1110 deleted the pager-audit branch June 30, 2026 15:46
@carbonci

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 159.15.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

8 participants