Skip to content

feat(Pagination): page links through getPageHref - #11578

Merged
nynexman4464 merged 7 commits into
mainfrom
nynexman4464/feat/pagination-page-links
Nov 14, 2026
Merged

nynexman4464 merged 7 commits into
mainfrom
nynexman4464/feat/pagination-page-links

Conversation

@nynexman4464

@nynexman4464 nynexman4464 commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

User need

Someone reading a paged list expects each page to be a destination: open page 7 in a new tab, copy its address, reach it before scripts load. Pagination's page number, Previous, Next, First and Last controls are buttons wired only to onChange, so none of that works.

  • Why it occurs: Button can render a link (href, as), but Pagination gives a caller no way to hand its Buttons a URL.
  • Why it harms the task: an app whose pages have their own URLs has to rebuild the control from Button links and generatePageRange, and keep its look, names and disabled ends in step by hand. The docs site needs this for its changelog, where each page of releases has its own URL.
  • Why a fixed href is not enough: apps address a page differently (a query parameter, a path segment, an offset, a cursor, page 1 with no parameter), so the URL has to come from the caller.

Problem and solution fit

Delta Why it is here
getPageHref(page, pageSize) The caller returns each page's URL; the Button controls render as links to it.
as Chooses the link component for those links, as on Button and Tab. LinkProvider applies too.
onChange(page) also runs for a plain link click State and analytics keep working when a control becomes a link. Its type does not change.
A Previous or Next link keeps its URL until the click is over The page change gave the link its next URL before the browser followed it, so a plain <a> Next link went one page too far.
A control keeps focus when it stops or starts being a link Button replaces a link with a disabled button at a boundary. Without this, a keyboard user's focus falls to the document (spec:AST-085 FR4).
menuItemRoles: each selector is a call marked pure Pagination takes isModifiedClick from that module. Its two selector constants ran when the module loaded, so every Pagination page carried them. A bundler now drops the ones an import does not use.
Records, docs, stories, tests, changeset Supporting.

No tagalongs.

Current specification

The spec owner's sign-off covers DEC-1 to DEC-3, FR16 to FR19, and Pagination joining family:navigation-destinations. Nothing else is left to decide.

Owner decisions (nynexman4464, 2026-11-13), recorded in this pull request as component:Pagination DEC-1, DEC-2 and DEC-3:

  1. The prop is getPageHref, and Pagination takes as.
  2. The page size is the generator's optional second argument: the control's page size when the caller sets pageSize or pageSizeOptions, otherwise undefined.
  3. The dots, the page box and the page-size selector are not links. They keep today's behavior.
  4. onChange runs for a link click, as it does for a button control.
  5. onChange stays required, with its released type. It gains no second argument.

Existing authority the change relies on:

  • component:Button FR10 and FR11: link mode through as, then LinkProvider, then a native anchor; a disabled Button with href is a <button> that runs no onClick.
  • family:navigation-destinations FR1, FR2, FR7 and its membership rule: Pagination joins the family; Button and useLinkComponent decide each destination.
  • architecture:public-component-api INV2 and DEC-1 (href and as are the system's words), INV4 with spec:AST-002 DEC-1 (only the caller knows its URL shape), INV18 and INV21 (no per-item props, render function or compound parts beside the existing API).
  • spec:AST-085 FR4 and FR7: a control that becomes disabled while it holds focus keeps focus. Its verification row names Pagination's last page, and focus on the document body fails.
  • architecture:interaction-modality INV1: a focus that script moves shows the indicator the last input calls for.

The type break raised in review is resolved by keeping the released type. PaginationProps stays an interface, and onChange: (page: number) => void is the same as on the base. The only public additions are two optional props.

The browser follows the URL that was activated (FR17). A link click changes the page, and React renders the Previous and Next links with their next URLs before the browser follows the link. With a plain <a>, a Next link on page 2 then went to page 4. Every earlier head of this pull request had this; a link component that navigates on the client did not, because it reads its href prop. Previous and Next now count from the page of the click until the click is over. The next task releases that, and so does a key or pointer press that arrives sooner, so a second activation counts from the new page.

A page link keeps focus (FR19). Button replaces a link with a disabled <button> when the control becomes unavailable, and puts the link back when it is available again. Pagination now moves the focus across that replacement, so the control holds focus afterwards as a button control does. Each control calls Core's shared hook for this replacement once, useFocusAcrossSwap, the one Item, TreeListItem and NavHeadingMenuItem use (architecture:react-component-runtime INV16). The hook notes the focus when React detaches the old element, and focuses the new one in the same commit, only when the document dropped the focus. The hook and Button are not changed.

Public delta and caller burden

getPageHref?: (page: number, pageSize?: number) => string; // new
as?: LinkComponentType;                                     // new
onChange: (page: number) => void;                           // unchanged

Behavior with getPageHref, and the clause that states it:

  • Page numbers, Previous, Next, First and Last are links (pages, count, compact, none, and the arrows of dots and input). Names are unchanged; the current page keeps aria-current="page". An unavailable end, and every control under isDisabled, stays a disabled button, and Pagination asks for no URL for it (FR16).
  • A plain click or Enter on a link runs the page change as a button control does (onChange(page), announcement, changeAction, optimistic page), and then the link navigates. Pagination never cancels the click (FR17, DEC-1).
  • The browser follows the URL that was activated. The page change gives a Previous or Next link its next URL only after the click is over (FR17).
  • A click that does not navigate this document changes no page here: a Control, Meta, Shift or Alt click, a link whose target is not _self, and a link whose URL the shared navigation rule rejects. The page of this document did not change, so onChange does not run and nothing is announced (FR17).
  • A control that stops or starts being a link while it holds focus keeps the focus. This covers a Previous, Next, First or Last link that reaches the first or last page, any page link while isDisabled is on, and the way back. The focus ring follows the last input: shown after a key, not after a pointer. A control that did not hold focus takes none (FR19).
  • The dots, the page box and the page-size selector are unchanged (FR18, DEC-2).
  • Cursor paging: Previous and Next ask for the page before and after the current one; the caller maps it to its cursor's URL (FR16).

Compatibility: additive. A Pagination without getPageHref renders and behaves as before. No theming change: a link is the same Button target.

Before, a page is reachable only through script:

<Pagination
  page={page}
  totalPages={pageCount}
  onChange={next => router.push(pagePath(next))}
/>

After, each page is a link. The app's link component (LinkProvider, or as) owns client-side navigation, replace or push, and prefetch. onChange is for state or analytics and does not navigate:

<Pagination
  page={page}
  totalPages={pageCount}
  getPageHref={pagePath}
  onChange={trackPage}
/>

With a page-size selector, the app navigates for a size choice in onPageSizeChange, never in the onChange(1) that follows:

<Pagination
  variant="count"
  page={page}
  totalItems={total}
  pageSize={pageSize}
  pageSizeOptions={[10, 20, 50]}
  getPageHref={pagePath} // (page, pageSize) => URL
  onPageSizeChange={size => router.push(pagePath(1, size))}
  onChange={trackPage}
/>

Decisions the caller makes:

  • Write the URL function, and pick the link component when the app has a router.
  • Keep navigation out of onChange when getPageHref is set. onChange does not say which control changed the page.
  • For that reason, an app that navigates in onChange for the dots or the page box leaves getPageHref unset in the dots and input variants. With it set, their arrow links would navigate and onChange would navigate again.
  • In cursor paging, map the neighboring page to a cursor URL.

Design and alternatives

A URL function keeps the page range, names, current page and disabled ends inside Pagination and leaves only the URL to the caller. Primer (hrefBuilder) and Ark UI (getPageUrl) take the same route.

Rejected:

  • A per-item props function (Mantine getItemProps): the caller reaches into Button's props and has to work out the Previous and Next targets.
  • A render function (MUI renderItem, Ant Design itemRender): the caller owns each control's markup, and as and LinkProvider already swap the element.
  • Compound parts (shadcn/ui): a second API for one job, and the caller owns the page range again.
  • A URL template string: cannot say "page 1 has no segment", an offset, or a cursor.
  • Links for the dots, the page box and the page-size selector (DEC-2). The dots are a radio group where focus selects the page, so a link would navigate on each arrow key; the other two have no destination until a value is committed.
  • An optional onChange where every control is a link (DEC-3): its type would depend on the variant and on pageSizeOptions, and a wrapper that calls props.onChange(page) stops compiling.
  • A second onChange argument that names the control (DEC-3): a handler with its own second parameter stops compiling.

Evidence

  • Unit tests. 46 new cases in Pagination.test.tsx (152 in the file). Links: each link and its URL, step, the page-size argument (unset, pageSize, pageSizeOptions, an empty option list), as, LinkProvider, the exact URLs requested at each boundary and while disabled, cursor paging, a rejected URL, plain, modified and target clicks, one onChange(page) call for a plain link click, the dots and the page box with getPageHref, the order of a page-size choice, and tooltips on link controls. The followed URL: a clicked Previous or Next link keeps its URL until the click is over, a second click in the same task repeats the page, a key or pointer press releases it, its timer is released on unmount, and a button control is unchanged. Focus: First, Previous, Next and Last links that reach a boundary, a link component, isDisabled on and off, a page the caller sets, a page that arrives after the click, another control used, focus elsewhere, and focus that left the control earlier.

  • First-load size without getPageHref. A page that renders Pagination and never passes getPageHref loads 119,219 B gzip of JavaScript on the merge base and 119,479 B on this head: +260 B, under the 0.3 KB that architecture:component-import-boundaries INV10 allows an unused optional feature. The head before this one was at +338 B. Measured on each commit with the repository's size-report build of the Pagination entry:

    node --input-type=module -e "
    import {measureEntry} from './scripts/check-component-import-boundaries.mjs';
    const {eagerGzipBytes} = await measureEntry({
      name: 'Pagination',
      module: 'packages/core/src/Pagination/Pagination.tsx',
    });
    console.log(eagerGzipBytes);"

    The shared menuItemRoles module does not grow. Each of INV10's four reference pages (docs, form, menu, table), built the same way, loads the same bytes with the base copy of that module and with this one: +0 B on each. The docs and form pages do not reach it. Two new tests pin the module: its selector values, and that an import of isModifiedClick carries no role set and no selector.

  • Mutation check. 21 single-line mutations on this head, over the lines its last commit changes: the click guard (a rejected URL, _self, its case, a modifier key), the URL of a disabled or unavailable control, the page-size argument, a link click that skips or always runs the page change, the URL hold (not set, set from the new page, not released by time, by a key or by a pointer press), its timer left behind at the next click or on unmount, the shared hook's ref left off, and in menuItemRoles a selector that is not marked pure or has the wrong value. Each fails at least one test. Earlier heads ran 46 and 17 over the rest of the link code, all caught.

  • Links in real browsers. A new committed spec, PaginationLinks.a11y.browser.spec.ts, drives the built stories with real key and pointer input: the URL the browser follows for Next and Previous (Enter and click, back to back), a button control at the last page, Next and Previous links of a plain <a> that reach a boundary, and the links of a client-side router that disables the control while it navigates (a new story, "Page links (client-side router)"). The focus cases assert that the control holds focus after every change to the landmark, with the ring after a key press and without it after a pointer click. 9 tests pass in Chromium 149 and WebKit 26.5, and in Firefox 151 with the same spec under a scratch project, three repeats each. On an earlier head, without the focus move, the link focus cases failed with focus on <body>, and without the URL hold, the first click on Next from page 1 went to #page-3 in all three engines.

  • Types. With the repository's TypeScript on a scratch file against the component: a wrapper that calls props.onChange(page) on PaginationProps compiles; interface X extends PaginationProps compiles; a handler (page: number, replace?: boolean) => void passed as onChange compiles; <Pagination page={1} totalPages={5} /> is an error (TS2741, onChange is missing).

  • No visual change. The same story with and without getPageHref, compared pixel by pixel at 2x: numbered and dots variants, light and dark, in four states (page 1, a middle page, pointer on Next, keyboard focus on Next). 0 different pixels in all 16 comparisons in Chromium 149, in Firefox 151 and in WebKit 26.5, with the links present in the DOM (7 on the numbered story). The four states differ from each other by hundreds to thousands of pixels, so the comparison can see a change.

  • Unchanged paths. The 106 existing Pagination tests pass unchanged, and the base branch's copy of the test file passes against this head (106 of 106). The tests of the shared hook's other callers pass (the Item, NavMenu and TreeList folders: 300 tests), and so do the tests of every folder that imports menuItemRoles (DropdownMenu, ContextMenu, Breadcrumbs, TabList, NavMenu, AppShell and Pagination: 916 tests). The existing browser specs that load Pagination stories pass in Chromium (RadioGroup.a11y.chromium.spec.ts, 31 passed; PaginationTextSize.interaction.browser.spec.ts, 5 passed).

Scope

Components: Pagination. One internal module that it imports also changes: DropdownMenu/menuItemRoles.ts.

  • One capability is added.
  • Unrelated fixes, cleanup, and policy changes were removed or split.
  • Consumer docs, focused tests, and migration evidence ship with the feature.
  • Public text and artifacts contain no internal Meta context.

Testing

pnpm exec vitest run --project ui packages/core/src/Pagination/Pagination.test.tsx   # 152 passed
pnpm exec playwright test --config playwright.config.ts --project=chromium --project=webkit \
  packages/core/src/Pagination/__tests__/PaginationLinks.a11y.browser.spec.ts       # 9 passed in each
pnpm exec vitest run --project ui packages/core/src/DropdownMenu/menuItemRoles.test.ts   # 3 passed
pnpm exec vitest run --project node scripts/menu-item-roles-bundle.test.mjs              # 2 passed
pnpm -F @astryxdesign/core typecheck
pnpm -F @astryxdesign/storybook typecheck
pnpm exec eslint packages/core/src/Pagination apps/storybook/stories/Pagination.stories.tsx
pnpm check:repo               # includes check:knowledge and check:changesets
pnpm review:pre --head HEAD   # 0 findings, 1,693 authored lines
pnpm exec vitest run          # 2,205 files passed, 2 failed (below)

The full run's two failing files import nothing this change touches, and every failure is a 30 s timeout. .github/scripts/lib/offline-media.test.mjs (2 tests) waits on an unreachable remote host from this machine's network, and fails the same way on the base branch. packages/cli/foundation/doc-compiler/stored-docs.test.mjs (1 test) times out under the full run's load; run alone, the file passes on this branch and on the base branch (7 tests).

Not done: no real-browser test of a click that opens elsewhere (a modifier key or a target). The unit tests cover it, and the Pagination record lists the gap.

Writing rubric results

R1 narration: none added. The glance row "Public contract" opened with "None changes."; it now states the contract.
R2 research: none in the record. The library comparison, and what other Core components do for a click that opens elsewhere, are in this description and its review.
R3 evidence: new basis cells cite DEC-1, DEC-2, DEC-3, spec:AST-085 FR4 and FR7, component:Button FR10 and FR11, family:navigation-destinations, and current source and tests. FR19 cites architecture:react-component-runtime INV16 for the shared hook and architecture:interaction-modality INV1 for the ring, and its verification row names the key and pointer cases. The FR13 verification row said its tests assert native `disabled`; it names what they assert (`aria-disabled`, and focus kept on Next at the last page). The FR13, FR16 and FR17, and FR19 rows name the new browser spec, and FR13's evidence gap (no real-browser test of focus at a boundary) is closed. FR17 states that the browser follows the URL that was activated, with current tests as its basis.
R4 rejected alternatives: three, each one line inside its decision (one in DEC-1, two in DEC-3).
R5 change references: none.
R6 open questions: the two questions on the `onChange` type are answered, so they left Open questions and their options collapsed into DEC-3. The question on clicks that open elsewhere became a requirement with its reason (FR17). OQ1 and OQ2 are unchanged.
R7 project status: none added. Six places said the Buttons are natively disabled and drop focus at a boundary; each states the behavior. The gap of a page link that loses focus is gone from FR13, FR16, the glance rows, Ownership and Current-state impact: FR19 states the behavior in the present tense, and Ownership states what Button owns (the replacement) and what Pagination owns (the focus across it).

Pagination's page number, previous, next, first and last controls were
buttons wired only to onChange, so a page could not open in a new tab, be
copied as a link, or work before scripts load.

`getPageHref(page, pageSize)` returns each page's URL, and those controls
render as links to it through Button's link mode. `as` sets the link
component, and LinkProvider applies. The URL is the caller's, so a query
parameter, a path segment, an offset or a cursor all work. `pageSize` is
passed when the caller sets `pageSize` or `pageSizeOptions`.

`onChange` is optional with `getPageHref` and still runs for a plain
activation, with the link's click event as a second argument. A click that
the browser opens elsewhere changes no page here. A disabled or unavailable
control stays a button and asks for no URL.

The dots, the page box and the page-size selector are not links: they keep
their callbacks. A control with no link and no callback is disabled, with a
development warning.
A link whose URL the navigation rule rejects renders with no `href`. Its
click now changes no page, like a click that the browser opens elsewhere.
A `target` of `_self` in any letter case counts as this tab.

The docs and the record state the order of a page-size choice
(`onPageSizeChange(size)`, then `onChange(1)`), and a test holds it. The
record lists its open questions and the focus gap of a link at a boundary.
The tests assert the exact URLs requested and the count of rejected links.
@vercel

vercel Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 14, 2026 9:18am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 13, 2026
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 13, 2026
@astracat-bot

astracat-bot Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 14, 2026, 9:39 AM UTC

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · bef0871

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
DropdownMenu 104.2 kB (0) · 18.5 kB CSS (0) — ✗ · ✓ · ✓
DropdownMenuDivider 5.3 kB (0) · 548 B CSS (0) — ✗ · ✓ · —
DropdownMenuGroup 6.4 kB (0) · 3.4 kB CSS (0) — ✗ · ✓ · —
21 more components
Component Size LoC Visual · A11y · RTL
DropdownMenuRadioGroup 6.6 kB (0) · 3.3 kB CSS (0) — ✗ · ✓ · —
DropdownMenuSubMenu 74.4 kB (0) · 10.1 kB CSS (0) — ✗ · ✓ · ✓
DropdownMenuItem 23.0 kB (−50 B) · 6.6 kB CSS (0) — ✗ · ✓ · —
DropdownMenuCheckboxItem 23.8 kB (−53 B) · 7.0 kB CSS (0) — ✗ · ✓ · ✓
DropdownMenuRadioItem 23.9 kB (−66 B) · 7.0 kB CSS (0) — ✗ · ✓ · —
Pagination · Storybook 121.1 kB (+262 B) · 18.8 kB CSS (0) 701 (+34) ✓ · ✓ · ✓
BreadcrumbItem 91.6 kB (0) · 12.9 kB CSS (0) — — · — · —
ContextMenu 117.5 kB (0) · 18.3 kB CSS (0) — — · — · —
Markdown 198.6 kB (0) · 21.5 kB CSS (0) — — · — · —
MoreMenu 104.4 kB (0) · 18.5 kB CSS (0) — — · — · —
Table 135.6 kB (0) · 19.2 kB CSS (0) — — · — · —
TableCell 118.7 kB (0) · 18.8 kB CSS (0) — — · — · —
TableHeaderCell 118.3 kB (0) · 18.6 kB CSS (0) — — · — · —
lab/Comments 367.5 kB (0) · 2.5 kB CSS (0) — — · — · —
lab/CommentThread 360.7 kB (0) · 2.4 kB CSS (0) — — · — · —
TabMenu 78.6 kB (−5 B) · 11.9 kB CSS (0) — — · — · —
ContextMenuItem 33.6 kB (−50 B) · 6.8 kB CSS (0) — — · — · —
SideNavItem 76.7 kB (−60 B) · 11.9 kB CSS (0) — — · — · —
TopNavItem 14.5 kB (−60 B) · 4.0 kB CSS (0) — — · — · —
TopNavMegaMenuItem 14.2 kB (−61 B) · 4.2 kB CSS (0) — — · — · —
TopNavMenu 81.3 kB (−69 B) · 12.0 kB CSS (0) — — · — · —
Visual changes: 4 snapshots in 1 component

A change is a question for the reviewer, not a failure.

Component · story Before After Diff
DropdownMenu · Lab Checkbox Items (probe, dark) before frame after frame diff frame
DropdownMenu · Lab Checkbox Items (probe, light) before frame after frame diff frame
DropdownMenu · Lab Checkbox Items (neutral, dark) before frame after frame diff frame
DropdownMenu · Lab Checkbox Items (neutral, light) before frame after frame diff frame

Package size: @astryxdesign/core 7.52 MB packed (+3.7 kB); no new dependencies.

API changes: core +2 · ~0 · −0

2 API changes (advisory)
Package Where Signature Usage
+ core . · Components · component Pagination prop as?: LinkComponentType <Pagination as={…} />
+ core . · Components · component Pagination prop getPageHref?: (page: number, pageSize?: number) => string <Pagination getPageHref={…} />

Touched components checked; add ci:run-visual, ci:run-a11y or ci:run-rtl to run the full suites.


Generated by PR Enrichment workflow | View full report

@astracat-bot astracat-bot Bot 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.

Approval waits on an engineering owner's decision on the proposed component:Pagination changes, and four fixes are needed either way.

An engineering owner records that decision by commenting /approve-spec <full head SHA>; the author may do so as an engineering owner. It covers DEC-1, DEC-2 and FR16–FR19, the open questions OQ3–OQ5, and whether a page link may lose focus at a boundary against spec:AST-085 FR4.

  • Making onChange optional breaks TypeScript wrappers that call props.onChange(page) (TS2722), so the record's "additive" compatibility class, the description and the patch changeset must either state the break or keep the released type.
  • With no link and no callback, Previous, Next, First and Last are disabled but keep their tooltips (Pagination.tsx:951, :969, :987, :1004), against FR12's "tooltip only while available".
  • The record now says both that button controls keep focus at a boundary (FR16 and Current-state impact) and that they are natively disabled and drop focus (FR13, the End-user impact, Compatibility and Disabled rows), so one side needs correcting.
  • OQ4 says DropdownMenuItem link rows skip their handler for clicks that open elsewhere, but they skip only modified clicks (DropdownMenuItem.tsx:229), not plain clicks on target="_blank" rows.
Claims and files checked
  • Claim: with the URL function set, page numbers, Previous, Next, First and Last render as links — verified (page-link tests; a real anchor with its URL in Chromium).
  • Claim: a page link opens in a new tab, copies, and works before scripts load — verified from the code (Button renders a real anchor in the server markup).
  • Claim: the URL takes the app's shape and receives the page size only when one is set — verified (tests for unset, set size and size options).
  • Claim: the link component comes from the new prop, else the link provider — verified (tests, the prop winning).
  • Claim: the page-change callback is optional, still runs for each page change, and gets the click event from a link — verified (tests).
  • Claim: the dots, the page box and the page-size selector stay controls — verified (tests).
  • Claim: a Pagination without the URL function is unchanged — verified at runtime; the callback's type change is the first finding above.
  • Claim: the change is additive — false (a wrapper that calls the callback stops compiling).
  • Claim: menu link rows skip their handler for clicks that open elsewhere — false for new-tab targets (only modified clicks are skipped).
  • Claim: tabs and buttons run their handlers for every click — verified (source).
  • Claim: a focused link at a boundary loses focus while a button keeps it — verified (Chromium frames).
  • Claim: a Pagination with no callback now type-checks and is disabled with a warning — verified (test).
  • Claim: no visual change — verified in Chromium at rest and with focus (identical frames); Firefox and WebKit not rerun.
  • Claim: 32 new tests, the existing suite unchanged, 138 passing; typecheck, lint and repository checks pass — verified.
  • Claim: the mutation check, the full-suite run and the precedent in other libraries — not rerun or outside this repository.
  • File: Pagination.tsx — findings (tooltips on disabled carets; callback type change).
  • File: Pagination.spec.md — findings (compatibility class, focus contradiction, menu precedent).
  • File: .changeset/pagination-page-links.md — finding (described as additive and filed as a patch).
  • File: Pagination.doc.mjs — clear.
  • File: Pagination.test.tsx — clear.
  • File: Pagination.stories.tsx — clear.
  • File: docs/families/navigation-destinations.md — clear (its membership rule requires the entry).

Automated review (maintainer link)

Previous, Next, First and Last kept their tooltip when they were disabled
for having no link and no callback. The tooltip now follows the same
disabled value as the control.

The record said in six places that the Buttons are natively disabled and
drop focus at a boundary. They use `aria-disabled` and keep focus, and a
test now holds that. The one focus gap is a page link that becomes
unavailable: a disabled button replaces it.

The open question on clicks that open elsewhere now says what
DropdownMenuItem link rows do: they skip their handler for a modified
click, not for a `target`.

@astracat-bot astracat-bot Bot 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.

Approval waits on an engineering owner's decision on the proposed component:Pagination changes, and one fix is needed either way.

An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request; the author may do so as an engineering owner. It covers DEC-1, DEC-2 and FR16–FR19, the open questions OQ3–OQ5, and whether a page link may lose focus at a boundary against spec:AST-085 FR4.

  • Making onChange optional breaks TypeScript wrappers that call props.onChange(page) (TS2722), so the record's "additive" compatibility class, the description and the patch changeset must either state the break and file it as [breaking] (minor, per spec:AST-017 FR7 and FR25) or keep the released type.

The tooltip, focus-wording and menu-precedent fixes from the last review are in.

Claims and files checked
  • Claim: with the URL function set, page numbers, Previous, Next, First and Last render as links — verified (page-link tests; anchors with their URLs in Chromium).
  • Claim: a page link opens in a new tab, copies, and works before scripts load — verified from the code (Button renders a real anchor in its server markup).
  • Claim: the URL takes the app's shape and gets the page size only when one is set — verified (tests for an unset size, a set size and size options).
  • Claim: the link component comes from the new prop, else the link provider — verified (tests; the prop wins).
  • Claim: the page-change callback is optional, runs for each page change, and receives the click event from a link — verified (tests).
  • Claim: a modified click, a link that opens in another target, or a rejected URL changes no page — verified (tests).
  • Claim: the dots, the page box and the page-size selector stay controls, and a size choice reports the size and then page 1 — verified (tests).
  • Claim: a control with no link and no callback is disabled, shows no tooltip and warns — verified (tests).
  • Claim: a Pagination without the URL function is unchanged — verified at runtime; the callback's type change is the finding above.
  • Claim: the change is additive — false (a wrapper that calls the callback stops compiling).
  • Claim: menu link rows skip their handler only for modified clicks, and tabs and buttons run theirs for every click — verified (source).
  • Claim: a button control keeps focus at a boundary while a page link loses it — verified (Chromium in this review; the new focus test).
  • Claim: no visual change — verified in Chromium at rest and with keyboard focus on Next (pixel-identical frames); Firefox and WebKit not rerun.
  • Claim: 34 new tests, 106 existing tests unchanged, 140 passing; typecheck, lint and the record and changeset checks pass — verified.
  • Claim: the Storybook typecheck, the full-suite run, the pre-review tool run and the mutation check — not rerun.
  • Claim: the six focus statements and the menu precedent in the record are corrected — verified.
  • File: Pagination.tsx — finding (callback type change); a non-blocking comment note.
  • File: Pagination.spec.md — finding (compatibility class says additive).
  • File: .changeset/pagination-page-links.md — finding (filed as a patch feature).
  • File: Pagination.doc.mjs — clear.
  • File: Pagination.test.tsx — clear.
  • File: Pagination.stories.tsx — clear.
  • File: docs/families/navigation-destinations.md — clear (its membership rule requires the entry).

Automated review (maintainer link)

`onChange` is required again and receives the page alone, as before page
links. A plain click on a page link calls `onChange(page)` as a button
control does, and the link navigates. A wrapper that calls
`props.onChange(page)`, an interface that extends `PaginationProps`, and a
handler with its own second parameter all compile as they did.

With `onChange` required, a control always has a callback. The disabling of
a control with no link and no callback, its development warnings and their
tests are gone, and the tooltips follow availability as before.

The record states the click rule as a requirement: a click that does not
navigate this document changes no page here. It records the `onChange`
decision and has no open question left on it. The docs say where an app
navigates: not in `onChange` when the controls are links, and in
`onPageSizeChange` for a page-size choice.

@astracat-bot astracat-bot Bot 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.

Approval waits on an engineering owner's decision on the proposed component:Pagination changes, and one fix is needed either way.

An engineering owner records that decision, covering DEC-1 to DEC-3, FR16–FR18 and Pagination joining family:navigation-destinations, by commenting /approve-spec <full head SHA> on this pull request; the author may do so as an engineering owner.

  • Miss: a focused Previous, Next, First or Last link that reaches the first or last page is replaced by a disabled button and focus falls to the page, against spec:AST-085 FR4, which approving the Pagination record does not amend, so move focus before the change to a destination FR16 names (the target page's link, else the opposite arrow) or have AST-085 amended here.

The onChange type break and the earlier tooltip, focus-wording and menu-precedent points are resolved; CI has not run on this draft head.

Claims and files checked
  • Claim: with the URL function set, the page number, previous, next, first and last controls render as links — verified (page-link tests; anchors with their URLs in Chromium).
  • Claim: a page link opens in a new tab, copies, and works before scripts load — verified from the code (Button renders a real anchor in its server markup).
  • Claim: the URL function gets the page, and the page size only when one is set, and may return any URL shape — verified (tests for an unset size, a set size, size options, an empty option list and cursor paging).
  • Claim: the link-component prop sets the link component, and the link provider applies — verified (tests; the prop wins).
  • Claim: a plain click or Enter on a link runs the page change (callback, announcement, async action) and is never cancelled — verified (test; Enter activates an anchor through its click).
  • Claim: a modified click, a link that opens in another target, or a rejected URL changes no page — verified (tests).
  • Claim: an unavailable end, and every control while disabled, stays a disabled button and asks for no URL — verified (tests).
  • Claim: cursor paging asks for the pages before and after the current one — verified (tests).
  • Claim: the dots, the page box and the page-size selector stay controls, and a size choice reports the size and then page 1 — verified (tests).
  • Claim: the page-change callback keeps its released, required, page-only type, so wrappers and extending interfaces compile and leaving it out is a type error — verified from the declaration; no compile probe was run.
  • Claim: a Pagination without the URL function is unchanged, with no theming change — verified (unchanged path; pixel-identical Chromium frames).
  • Claim: no visual change — verified in Chromium at rest and with keyboard focus on Next; Firefox and WebKit not rerun.
  • Claim: a button control keeps focus at a boundary while a page link loses it — verified (the new unit test; Chromium in this review).
  • Claim: 28 new tests, 106 existing tests unchanged, 134 passing, Core typecheck passing, 880 authored lines — verified.
  • Claim: the Storybook typecheck, lint, repository checks, pre-review tool, full-suite run, mutation check, existing browser specs and the Firefox and WebKit runs — not rerun.
  • Claim: other libraries use the same URL-function design — not checkable from this repository.
  • File: Pagination.tsx — finding (boundary focus); two non-blocking comment notes.
  • File: Pagination.spec.md — FR16 records the focus gap the finding names; the rest waits on the owner decision.
  • File: Pagination.test.tsx — clear.
  • File: Pagination.doc.mjs — clear.
  • File: Pagination.stories.tsx — clear.
  • File: .changeset/pagination-page-links.md — clear.
  • File: docs/families/navigation-destinations.md — clear (its membership rule requires the entry).

Automated review (maintainer link)

A control that stops or starts being a link while it holds focus keeps
that focus. Button replaces a link with a disabled button when the control
becomes unavailable, at the first or last page or while the pagination is
disabled, and the document dropped the focus of the link. Pagination now
notes the focus before the replacement and moves it to the new element in
the same commit, with the focus ring that the last input calls for.

The browser follows the URL of the Previous or Next link that was
activated. The page change gave the link its next URL before the browser
followed it, so a plain anchor went one page too far. Previous and Next
now count from the page of the click until the click is over.

A new browser spec covers both in Chromium and WebKit, with a story whose
links navigate through a client-side router.
@nynexman4464

Copy link
Copy Markdown
Contributor Author

/approve-spec 48d5b92

@nynexman4464
nynexman4464 marked this pull request as ready for review November 14, 2026 06:05
@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 14, 2026
… hook

A Pagination control keeps focus when Button replaces its element through
`useFocusAcrossSwap`, the hook that Item, TreeListItem and
NavHeadingMenuItem use for the same replacement. The control calls it
once, and the snapshot wrapper is gone. The hook is not changed.

The browser spec adds the pointer case: after a click takes a Next link to
the last page, the button that replaces it holds focus without the ring.

The file header is shorter.
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 14, 2026
@nynexman4464

Copy link
Copy Markdown
Contributor Author

/approve-spec 32d2ab4

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 14, 2026

@astracat-bot astracat-bot Bot 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.

Changes are needed before approval. An engineering owner approved the proposed component:Pagination and navigation-family record changes at this head, so one fix remains.

  • Newly live check: the page-link wiring loads with every Pagination and adds 338 B gzip of first-load JavaScript to a page that renders Pagination without getPageHref, over the 0.3 KB that the component import boundaries record allows an unused optional feature, so move it behind its own import or a deferred load, or trim it under 0.3 KB (taking isModifiedClick without the menu selector setup in menuItemRoles brings it to about 280 B), and report the base-against-head first-load gzip delta in the description.

Last review's points are fixed: each control now calls useFocusAcrossSwap once, and the test counts match the head. The page-link browser spec passes in Chromium, and the CI checks that have finished on this head pass.

Claims and files checked
  • Claim: with the URL function set, the page number, previous, next, first and last controls render as links. Verified by the page-link tests and by anchors in Chromium.
  • Claim: a page link opens in a new tab, its address copies, and it works before scripts load. Verified from the code: Button renders a real anchor with the URL in its server markup.
  • Claim: the URL function gets the page, gets the page size only when the caller sets one, and may return any URL shape, cursor paging included. Verified by tests.
  • Claim: the link-component prop sets the link component, and the link provider applies too. Verified by tests.
  • Claim: a plain click or Enter on a link runs the page change and is never cancelled. Verified by test.
  • Claim: the browser follows the URL that was activated, and a new key or pointer press counts from the new page. Verified by tests and by the browser spec in Chromium.
  • Claim: a modified click, a link with another target, or a rejected URL changes no page. Verified by tests.
  • Claim: a control that stops or starts being a link while focused keeps focus, with the ring for the last input, and a control that did not hold focus takes none. Verified by tests, the browser spec in Chromium and capture probes.
  • Claim: an unavailable end, and every control while disabled, stays a disabled button and asks for no URL. Verified by tests.
  • Claim: the dots, the page box and the page-size selector stay controls, and a size choice reports the size and then page 1. Verified by tests.
  • Claim: the page-change callback keeps its released type, and only two optional props are added. Verified from the unchanged declaration and the API generator's two added rows.
  • Claim: each control calls the shared focus-across-swap hook once, and the hook and Button are unchanged. Verified from the source and the diff.
  • Claim: a Pagination without the URL function is unchanged. Verified for rendering and behavior (the base branch's 106 tests pass on this head, frames identical); its first-load size grows (finding above).
  • Claim: no visual change. Verified in Chromium with pixel-identical frames; Firefox and WebKit were not rerun.
  • Claim: 46 new unit tests, 152 in the file, 1,604 authored lines, and the typecheck, lint and knowledge checks pass. Verified.
  • Claim: the browser spec's 9 tests pass in Chromium, WebKit and Firefox. Verified in Chromium; WebKit and Firefox were not run.
  • Claim: the mutation check, the full test run, the Storybook typecheck, the other hook callers' tests and the older browser specs pass. Not rerun.
  • Claim: other libraries take the same URL-function route. Not checkable from this repository.
  • Claim: the spec owner's sign-off covers the record changes. Verified: an engineering owner approved this head.
  • File: packages/core/src/Pagination/Pagination.tsx: the first-load finding; a non-blocking note on PaginationButton's JSDoc.
  • File: packages/core/src/Pagination/Pagination.test.tsx: clear.
  • File: packages/core/src/Pagination/__tests__/PaginationLinks.a11y.browser.spec.ts: clear (passes in Chromium).
  • File: docs/specs/components/Pagination/Pagination.spec.md: clear (approved at this head; consistent with the code).
  • File: docs/families/navigation-destinations.md: clear (its membership rule requires the entry).
  • File: packages/core/src/Pagination/Pagination.doc.mjs: clear.
  • File: apps/storybook/stories/Pagination.stories.tsx: clear.
  • File: .changeset/pagination-page-links.md: clear.

Automated review (maintainer link)

A Pagination without `getPageHref` now loads 260 B gzip more than it did
before page links. It was 338 B.

`menuItemRoles` builds each selector in a call marked pure, so a bundler
drops the selectors that an import does not use. Pagination takes
`isModifiedClick` from that module and loads no selector with it. A page
that uses the selectors loads the same bytes as before.

The link wiring in Pagination is smaller, with the same behavior. One
expression gives a control its URL. The click handler returns early for a
click that opens the URL elsewhere. The timer that ends the URL hold needs
no null checks.
@nynexman4464

Copy link
Copy Markdown
Contributor Author

/approve-spec bef0871

@astracat-bot astracat-bot Bot 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.

Approved pending CI: CI has not finished on this head yet. Its first run was cancelled because CI was full, and a re-run is in progress; merge waits for it.

An engineering owner approved the component:Pagination and navigation-destinations record changes at this head, and the earlier size finding is fixed: a page that renders Pagination without getPageHref now loads 260 B more gzip, within the 0.3 KB allowance, and the shared menu module costs the four reference pages nothing. The page links follow the clicked URL and keep focus at the first and last page in Chromium, and the frames at rest are pixel-identical to the buttons.

Claims and files checked
  • Verified: passing getPageHref makes the page number, previous, next, first and last controls links (Pagination.tsx:615-637, page-link tests, 7 links in the Page links story).
  • Verified: as picks the link component and LinkProvider applies, with as winning (unit tests).
  • Verified: onChange(page) still runs for a plain link click, and its type is unchanged (Pagination.tsx:83, :634, unit test).
  • Verified: the browser follows the activated URL, because Previous and Next keep their URL until the click is over (Pagination.tsx:509-517, :629-632; unit tests; Chromium follows page 2, page 4, page 3, and page 8 at the last page).
  • Verified: a modified click, a link whose target is not _self and a rejected URL change no page (Pagination.tsx:389-398, unit tests).
  • Verified: a control that stops or starts being a link keeps focus, with the ring after a key press and none after a pointer press (Pagination.tsx:403-406, unit tests, Chromium probes).
  • Verified: the dots, the page box and the page-size selector stay controls, and cursor paging asks for the page before and after the current one (unit tests).
  • Verified: the menu module's selectors are pure calls a bundler drops, so Pagination's import carries none (menuItemRoles.ts:24, :34, bundle test).
  • Verified: a page without getPageHref grows from 119,219 to 119,479 B gzip (+260 B), and the docs, form, menu and table pages are unchanged; the earlier head's +338 B matches the earlier measurement.
  • Verified: 46 new tests, 152 in the file, and the base's 106 pass unchanged; the authored size is 1,693 lines.
  • Verified: onChange stays required with its released type, so a wrapper that calls it compiles and a Pagination without it does not.
  • Verified: no visual change: base buttons and head links give identical Chromium frames at rest and at the last page.
  • Verified: the shared focus hook and Button are unchanged; the changeset describes the same behavior, and a Pagination without getPageHref is unchanged.
  • Not rechecked: the 21-mutation run, the WebKit and Firefox runs, and the other callers' test runs.
  • .changeset/pagination-page-links.md: clear.
  • apps/storybook/stories/Pagination.stories.tsx: clear.
  • docs/families/navigation-destinations.md: clear.
  • docs/specs/components/Pagination/Pagination.spec.md: clear.
  • packages/core/src/DropdownMenu/menuItemRoles.test.ts: clear.
  • packages/core/src/DropdownMenu/menuItemRoles.ts: clear.
  • packages/core/src/Pagination/Pagination.doc.mjs: clear.
  • packages/core/src/Pagination/Pagination.test.tsx: clear.
  • packages/core/src/Pagination/Pagination.tsx: clear.
  • packages/core/src/Pagination/__tests__/PaginationLinks.a11y.browser.spec.ts: clear.
  • scripts/menu-item-roles-bundle.test.mjs: clear.

Automated review (maintainer link)

github-actions Bot added a commit that referenced this pull request Nov 14, 2026
@nynexman4464
nynexman4464 merged commit 54f2116 into main Nov 14, 2026
157 of 190 checks passed
@github-actions
github-actions Bot deleted the nynexman4464/feat/pagination-page-links branch November 15, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — bef0871c Deployed Nov 14, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant