Skip to content

fix(pagination): center prev/next caret icons under the RTL mirror - #4723

Merged
cixzhang merged 1 commit into
mainfrom
fix/pagination-caret-icon-centering
Aug 5, 2026
Merged

fix(pagination): center prev/next caret icons under the RTL mirror#4723
cixzhang merged 1 commit into
mainfrom
fix/pagination-caret-icon-centering

Conversation

@freddymeta

Copy link
Copy Markdown
Contributor

What

The prev/next caret icons in Pagination render a few pixels above the button's vertical center. This centers them.

Root cause

The RTL chevron mirror (added in #4687) wraps each caret <Icon> in a <span {...rtlStyles.mirror}>. That span is display: contents, so it drops the icon out of the Button's flex icon-centering wrapper — the icon then aligns to the surrounding line-height baseline instead of the flex cross-center. At the 20px (md) icon size the buttons use, the drift is a visible ~3px (measured: the glyph sat at top: 3.1px / bottom: 8.9px in a 32px button).

Fix

Apply the mirror transform on the Icon directly via xstyle={rtlStyles.mirror} instead of a wrapper span. The icon stays a direct, centered flex child of the button (measured 6.0 / 6.0 after the fix) and still flips under RTL — the scaleX(-1) now rides on the icon's own element. No wrapper element, no new API.

Verification

  • Measured in Storybook: LTR and RTL both center the caret at 6.0 / 6.0; RTL still applies matrix(-1, 0, 0, 1, 0, 0) to the icon (mirror preserved).
  • Audited every other rtlStyles.mirror usage (SideNav, Lightbox, Carousel, Calendar, TreeList, Table tree/grouped/row-expansion) — those icons center correctly (they use 16px icons or a non-button context), so this is Pagination-specific.
  • 65/65 Pagination tests pass; typecheck + lint clean.

Screenshots (before/after, LTR + RTL) attached below.

@vercel

vercel Bot commented Aug 5, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview Aug 5, 2026 1:56pm

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 5, 2026
@github-actions github-actions Bot added community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge needs:design-review Affects visuals — Design should review labels Aug 5, 2026
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

Modified Components

Pagination (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 637 -
Complexity N/A Very High (92) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.7KB 1.2KB

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

github-actions Bot added a commit that referenced this pull request Aug 5, 2026
The RTL chevron mirror wrapped each caret icon in a display:contents span,
which dropped the icon out of the button flex-centering context and left the
glyph a few pixels high. Apply the mirror transform on the Icon directly via
xstyle instead, so the icon stays a centered flex child and still flips under
RTL, with no wrapper element.
@cixzhang
cixzhang force-pushed the fix/pagination-caret-icon-centering branch from 102919c to 3df096f Compare August 5, 2026 13:52
@github-actions github-actions Bot removed the needs:code-review High-risk change (new package/component/API) — needs human code review before merge label Aug 5, 2026
github-actions Bot added a commit that referenced this pull request Aug 5, 2026
@cixzhang
cixzhang merged commit 64f8487 into main Aug 5, 2026
19 checks passed
@github-actions
github-actions Bot deleted the fix/pagination-caret-icon-centering branch August 6, 2026 06:58
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. community Authored by a community contributor (not on the eng/design team) needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants