Skip to content

fix: SW-2441 Prevent data table pagination overflow - #210

Open
vmujakovic-ts wants to merge 1 commit into
mainfrom
SW-2441-pagination-fix
Open

fix: SW-2441 Prevent data table pagination overflow#210
vmujakovic-ts wants to merge 1 commit into
mainfrom
SW-2441-pagination-fix

Conversation

@vmujakovic-ts

@vmujakovic-ts vmujakovic-ts commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Jira

SW-2441

Summary

DataTablePagination rendered one button per page in a single horizontal
row. On tables with many pages the control grew past the available table
width and ran off the page, pushing the next/previous buttons out of reach
and making navigation difficult or inaccessible.

The page list is now capped at a bounded seven-item window that always
keeps the first page, the last page, and the pages adjacent to the current
one reachable. Skipped ranges collapse into non-interactive ellipses:

  • Near the start (page ≤ 4) — 1 2 3 4 5 … 20
  • In the middle1 … 9 10 11 … 20
  • Near the end (page ≥ count − 3) — 1 … 16 17 18 19 20

Tables with seven or fewer pages are unchanged and still render every page
number. As a second line of defense for narrow containers, the pagination
row and its two groups may now wrap (flex-wrap) instead of overflowing.

Previous/next controls, page-size selection, and the aria-label /
aria-current semantics on each page button are unchanged. The ellipses
are aria-hidden so they add no screen-reader noise.

Type of Change

  • Feature (new functionality)
  • Bug fix
  • Refactor
  • Documentation
  • Chore (build, CI, dependencies)
  • Breaking change

Checklist

  • yarn lint passes
  • yarn build passes
  • yarn test:all passes
  • Storybook stories added/updated — existing data-table stories cover the unchanged ≤ 7-page path
  • Code coverage remains the same or increased

Testing

Added regression coverage in data-table.test.tsx for a 20-page table,
exercising every branch of the new windowing helper:

  • distant pages collapse while the last page stays reachable (near-start)
  • current page keeps its neighbours, both gaps elide (middle)
  • trailing run of pages with a single leading ellipsis (near-end)
  • a 7-page table still renders every number with no ellipsis (unwindowed)

Results:

  • yarn lint — clean
  • yarn typecheck — clean
  • yarn build — clean
  • yarn test — 1014 passed (64 files)
  • yarn test:storybook — 696 passed (111 files)

Coverage: data-table-pagination.tsx is at 100% statement coverage
(86/86 -> 104/104), taking the repo total from 96.9054% to 96.9076%.

Zephyr test cases: none added — the new coverage is a Vitest unit test, not
a story play function.

Verification

  • Deploys to preview environment for manual verification
  • All CI/E2E checks pass

Screenshots

Behavioral change is the page-number list; described textually above.

@vmujakovic-ts
vmujakovic-ts requested review from a team as code owners September 9, 2026 18:31
@vercel

vercel Bot commented Sep 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ts-lib-ui-kit-storybook Ready Ready Preview Sep 9, 2026 6:55pm UTC

Request Review

@vmujakovic-ts vmujakovic-ts changed the title fix: prevent table pagination overflow fix: prevent data table pagination overflow Sep 9, 2026

@unblocked unblocked 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.

✅ No issues found

About Unblocked

Unblocked has been set up to automatically review your team's pull requests to identify genuine bugs and issues.

📖 Documentation — Learn more in our docs.

💬 Ask questions — Mention @unblocked to request a review or summary, or ask follow-up questions.

👍 Give feedback — React to comments with 👍 or 👎 to help us improve.

⚙️ Customize — Adjust settings in your preferences.

@vmujakovic-ts vmujakovic-ts changed the title fix: prevent data table pagination overflow fix: SW-2441 Prevent data table pagination overflow Sep 9, 2026
Collapse distant page numbers into a bounded seven-item window with
ellipses, and let the pagination metadata and navigation controls wrap
in narrow containers.

Cover all three windowing branches (near-start, middle, near-end) plus
the unwindowed path, keeping the component at 100% statement coverage.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🟢 Lines 96.94% (🎯 83%)
🟰 ±0%
24706 / 25485
🟢 Statements 96.94% (🎯 83%)
🟰 ±0%
24706 / 25485
🟢 Functions 94.61% (🎯 74%)
🟰 ±0%
1178 / 1245
🟢 Branches 90.71% (🎯 81%)
⬆️ +0.02%
4973 / 5482
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/components/ui/data-table/data-table-pagination.tsx 100%
🟰 ±0%
92.59%
⬆️ +4.36%
100%
🟰 ±0%
100%
🟰 ±0%
Generated in workflow #1206 for commit 2f0062e by the Vitest Coverage Report Action

@boramyi-ts boramyi-ts left a comment

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.

LGTM

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.

3 participants