Skip to content

feat(pagination): improve keyboard navigation and accessibility - #2700

Open
SaiYugandhar03 wants to merge 3 commits into
siemens:mainfrom
SaiYugandhar03:pagination_a11y
Open

feat(pagination): improve keyboard navigation and accessibility#2700
SaiYugandhar03 wants to merge 3 commits into
siemens:mainfrom
SaiYugandhar03:pagination_a11y

Conversation

@SaiYugandhar03

@SaiYugandhar03 SaiYugandhar03 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

💡 What is the current behavior?

The Previous (left arrow) button is not reachable via Tab, and screen readers incorrectly announce page buttons, ellipsis. This results in incorrect keyboard navigation and misleading accessibility announcements.

Jira ticket: IX-4345

🆕 What is the new behavior?

The Previous (left arrow) button is reachable via Tab, and screen readers correctly announce page buttons, ellipsis, and providing proper keyboard navigation and accurate accessibility announcements.

🏁 Checklist

A pull request can only be merged if all of these conditions are met (where applicable):

  • 🦮 Accessibility (a11y) features were implemented
  • 🗺️ Internationalization (i18n) - no hard coded strings
  • 📲 Responsiveness - components handle viewport changes and content overflow gracefully
  • 📕 Add or update a Storybook story
  • 📄 Documentation was reviewed/updated siemens/ix-docs
  • 🧪 Unit tests were added/updated and pass (pnpm test)
  • 📸 Visual regression tests were added/updated and pass (Guide)
  • 🧐 Static code analysis passes (pnpm lint)
  • 🏗️ Successful compilation (pnpm build, changes pushed)

👨‍💻 Help & support

Summary by CodeRabbit

  • Accessibility
    • Improved pagination semantics for screen readers and assistive technologies.
    • Added clear labels identifying page buttons and three-page jump controls.
    • Marked the current page appropriately with aria-current="page".
    • Removed disabled previous and next buttons from keyboard navigation.
  • Tests
    • Updated pagination accessibility checks to verify current-page labeling.

@netlify

netlify Bot commented Aug 5, 2026

Copy link
Copy Markdown

Deploy Preview for ix-storybook ready!

Name Link
🔨 Latest commit 409625a
🔍 Latest deploy log https://app.netlify.com/projects/ix-storybook/deploys/6a7b3633897ae80008e6669a
😎 Deploy Preview https://deploy-preview-2700--ix-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@changeset-bot

changeset-bot Bot commented Aug 5, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 409625a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Pagination now uses explicit page and jump labels, aria-current="page" for the active page, navigation semantics, and keyboard exclusion for disabled boundary controls. The regression test verifies the active page attribute.

Changes

Pagination accessibility

Layer / File(s) Summary
Pagination control semantics
packages/core/src/components/pagination/pagination.tsx, packages/core/src/components/pagination/test/pagination.ct.ts
Page buttons use explicit labels and aria-current="page" for the active page. Overflow buttons identify their target pages. The host uses navigation semantics. Disabled boundary buttons receive tabIndex={-1}. The regression test verifies the active page attribute.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: alexkaduk

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the pagination accessibility and keyboard navigation changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@SaiYugandhar03
SaiYugandhar03 marked this pull request as ready for review August 11, 2026 05:04

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/core/src/components/pagination/pagination.tsx`:
- Around line 203-210: Update the overflow button labels and handlers in the
pagination component so the announced page jump matches the actual selected-page
movement at boundaries; either compute each button’s target delta for its
aria-label or make both handlers consistently move three pages, while preserving
the existing pagination behavior and tests.
- Around line 168-171: Localize the accessible labels and announcements
generated by the pagination component, including the “Go to” page label, both
jump announcements, and the “Pagination” label, instead of concatenating
hard-coded English with i18nPage. Reuse the existing localization mechanism or
add localized inputs, and if public props are introduced, update their JSDoc,
`@since` metadata, Storybook stories, and test-app examples.
- Around line 168-171: Update the selected-page attribute construction in the
pagination button rendering to remove aria-selected, retaining
aria-current="page" for the current button. Adjust the pagination component test
assertions to verify aria-current="page" instead of aria-selected.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 7f16b75a-61fe-4776-98a8-260eb781c6fb

📥 Commits

Reviewing files that changed from the base of the PR and between 5c43ed5 and 95976a3.

📒 Files selected for processing (2)
  • packages/core/src/components/pagination/pagination.tsx
  • packages/core/src/components/pagination/test/pagination.ct.ts

Comment thread packages/core/src/components/pagination/pagination.tsx Outdated
Comment thread packages/core/src/components/pagination/pagination.tsx
@SaiYugandhar03
SaiYugandhar03 requested a review from a team as a code owner August 11, 2026 14:48
@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/core/src/components/pagination/pagination.tsx`:
- Around line 168-169: Add a changeset for the affected pagination package
documenting the public accessibility behavior changes implemented around the
pagination component, including aria-current, accessible labels, navigation
semantics, and keyboard focus behavior.
- Line 188: Reuse the jump value declared in the pagination component’s jump
calculation in both backward and forward overflow handlers, replacing their
duplicate 2 * pageCount + 1 expressions. Ensure announced and selected
destinations use this shared jump value consistently.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 043ffa93-26ec-4ab4-b11f-aa4d4f4ed33d

📥 Commits

Reviewing files that changed from the base of the PR and between 95976a3 and 409625a.

📒 Files selected for processing (2)
  • packages/core/src/components/pagination/pagination.tsx
  • packages/core/src/components/pagination/test/pagination.ct.ts

Comment on lines +168 to +169
'aria-label': `${this.i18nPage} ${index + 1}`,
...(this.selectedPage === index ? { 'aria-current': 'page' } : {}),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Add a changeset for the accessibility behavior change.

This PR changes the public ix-pagination accessibility contract, including aria-current, accessible labels, navigation semantics, and keyboard focus behavior. Add a changeset for the affected package, or explicitly justify why this change is internal-only.

As per path instructions, “Changesets are required for public API updates, behavior changes, styling/theming changes, accessibility changes, and bug fixes with user impact.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/core/src/components/pagination/pagination.tsx` around lines 168 -
169, Add a changeset for the affected pagination package documenting the public
accessibility behavior changes implemented around the pagination component,
including aria-current, accessible labels, navigation semantics, and keyboard
focus behavior.

Source: Path instructions

let start = 0;
let end = Math.min(this.count, this.maxCountPages);
let pageCount = Math.floor((this.maxCountPages - 4) / 2);
const jump = Math.max(0, 2 * pageCount + 1);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Reuse jump in both overflow handlers.

Line 188 defines jump, but the backward and forward handlers recompute the same expression at Lines 195 and 243. Use jump in both handlers so the announced destination and selected destination always use one calculation.

Suggested change
-            this.selectPage(this.selectedPage - Math.max(0, 2 * pageCount + 1));
+            this.selectPage(this.selectedPage - jump);
...
-            this.selectPage(this.selectedPage + Math.max(0, 2 * pageCount + 1));
+            this.selectPage(this.selectedPage + jump);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const jump = Math.max(0, 2 * pageCount + 1);
this.selectPage(this.selectedPage - jump);
...
this.selectPage(this.selectedPage + jump);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/core/src/components/pagination/pagination.tsx` at line 188, Reuse
the jump value declared in the pagination component’s jump calculation in both
backward and forward overflow handlers, replacing their duplicate 2 * pageCount
+ 1 expressions. Ensure announced and selected destinations use this shared jump
value consistently.

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.

1 participant