Skip to content

fix(AppShell): replace hardcoded spacing with spacingVars tokens in skip link - #650

Merged
cixzhang merged 1 commit into
mainfrom
navi/theme-audit/app-shell
Mar 17, 2026
Merged

cixzhang merged 1 commit into
mainfrom
navi/theme-audit/app-shell

Conversation

@cixzhang

@cixzhang cixzhang commented Mar 17, 2026 •

Copy link
Copy Markdown
Contributor

What

Theme audit for XDSAppShell — the skip-to-content link used hardcoded pixel values for spacing in its :focus state. This PR replaces them with spacingVars tokens so theme authors can control skip link positioning through the token system.

Changes

Property Before After
padding '8px 16px' paddingBlock: spacingVars['--spacing-2'] / paddingInline: spacingVars['--spacing-4']
top '8px' spacingVars['--spacing-2']
insetInlineStart '8px' spacingVars['--spacing-2']

Also adds spacingVars to the import from tokens.stylex.

Audit Summary

Full theme audit of XDSAppShell:

  • ✅ Colors: All use colorVars tokens
  • ✅ Radii: Uses radiusVars['--radius-page']
  • ✅ Typography: Uses fontWeightVars, textSizeVars
  • ✅ Component reuse: No raw buttons/dividers/icons — shell is a layout component
  • ✅ xdsClassName: Applied on root div with variant info (app-shell, {height, variant})
  • 🔧 Spacing: 3 hardcoded values in skip link → fixed in this PR

Needs Review

The skip-to-content link is an accessibility pattern that only appears on keyboard focus. The hardcoded 8px / 16px values are small, unobtrusive positioning — not semantic UI spacing. While converting to tokens is technically correct and consistent, it does mean theme authors could inadvertently affect the skip link by changing global spacing tokens.

Question for maintainers: Should the skip link spacing follow the token system (this PR), or should it be considered an a11y exception with fixed values? If fixed values are preferred, this PR can be reverted.

Testing

  • ✅ All 31 AppShell tests pass
  • ✅ Lint clean (0 errors)

…kip link

The skip-to-content link used hardcoded pixel values for padding, top,
and insetInlineStart in its :focus state. Replace with spacingVars tokens
so theme authors can control skip link spacing through the token system.

Changes:
- padding: '8px 16px' → paddingBlock/paddingInline with --spacing-2/--spacing-4
- top: '8px' → spacingVars['--spacing-2']
- insetInlineStart: '8px' → spacingVars['--spacing-2']
- Add spacingVars to imports

Co-authored-by: Navi <[email protected]>
@cixzhang cixzhang added theming Theming system, design tokens, createTheme hardening Component hardening and quality sweep labels Mar 17, 2026
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Mar 17, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

Yeah should use the tokens

@github-actions

github-actions Bot commented Mar 17, 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

AppShell · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 625B N/A
Lines of Code N/A 375 -
Complexity N/A Very High (44) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@xds/core 9.5KB 15.3KB 2.4KB

Accessibility Audit

Status: No accessibility violations detected.


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

@cixzhang
cixzhang merged commit 8af4b83 into main Mar 17, 2026
11 checks passed
@cixzhang
cixzhang deleted the navi/theme-audit/app-shell branch March 20, 2026 16:59
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. hardening Component hardening and quality sweep theming Theming system, design tokens, createTheme

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant