Skip to content

test(Lightbox): the viewport spec skips only a cross-origin stylesheet - #9064

Merged
cixzhang merged 1 commit into
meta:mainfrom
vjeux:test/lightbox-viewport-cross-origin-skip
Oct 31, 2026
Merged

cixzhang merged 1 commit into
meta:mainfrom
vjeux:test/lightbox-viewport-cross-origin-skip

Conversation

@vjeux

@vjeux vjeux commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Maintainer impact

LightboxViewport.a11y.browser.spec.ts checks that the open viewer declares height: 100dvh by reading the page's stylesheets. Each sheet's walk sat inside an empty catch, meant for a cross-origin sheet whose rules a page can't read. That catch swallowed every other error too, so a same-origin sheet that failed to read was skipped in silence: the proof could pass on CSS it never read, or fail on a missing 100dvh that hid the real error.

Intended invariant

The proof's claim is unchanged: the open viewer declares height: 100dvh, so Safari's toolbar can't cover its caption (#8732). Only how it skips an unreadable sheet changes.

Change

The walk now skips only a sheet whose href resolves to another origin, and reads every other sheet with no catch, so any other error fails the proof. One test file and no product code, so no changeset.

Found while auditing the Lightbox proofs for catch blocks that could hide a failure. Prior art: no open pull request touches this spec (searched open pull requests for LightboxViewport, cross-origin stylesheet and styleSheets catch).

Evidence

  • Failure before the change: with a read error injected into each same-origin sheet that lacks the 100dvh rule, the spec on main passes; injected into every sheet, it fails on "expected [] to contain '100dvh'" rather than on the error.
  • Success after the change: both injections fail on the injected error, and without one the spec passes 2 of 2 in Chromium and in WebKit.
  • Product/runtime behavior verified unchanged: test-only change; the UI and node suites pass as on main.

Scope

  • No intended public API, product behavior, visual direction, or policy change.
  • Product changes discovered during the work were removed or split.
  • Public text and artifacts contain no internal Meta context.

Testing

Local gates at fd830f7 (on main d73908f):

The spec read every stylesheet's rules inside an empty catch, meant for a
cross-origin sheet whose rules a page can't read; it would also have
swallowed any other error and let the proof pass on what it never read. It
now skips only a sheet whose href has another origin, and lets anything
else throw.
@vercel

vercel Bot commented Oct 30, 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 Oct 30, 2026 10:22pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 30, 2026
@astracat-bot

astracat-bot Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 30, 2026, 10:40 PM UTC

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

🧪 Sandbox Preview

View Sandbox for this PR

Modified Components

Lightbox (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Entry File (ESM) 394B 394B 0B
Lines of Code 804 807 -
Complexity Very High Very High (87) -

Component Size

Component Import before Import after Delta CSS before CSS after Delta
core/Lightbox 52.8KB 52.8KB 0B 10.0KB 10.0KB 0B

Sizes are gzip. Import counts the JavaScript the import loads eagerly; CSS counts the package stylesheet rules referenced by the modules it can load from its own package, lazily loaded ones included.

Bundle Size Summary

Gzip figures measure each package's entry file, not the code an import pulls in.

Package Entry (ESM) Entry gzip before Entry gzip after Delta
@astryxdesign/core 4.9KB 1.2KB 1.2KB 0B
Package stylesheet Gzip before Gzip after Delta
@astryxdesign/core 35.6KB 35.6KB 0B

Accessibility Audit

Status: The accessibility audit did not run on this pull request. It runs after merges to main and before each release; pull requests that touch components run it with the ci:heavy-lanes label.


Generated by PR Enrichment workflow | Storybook | Sandbox | 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.

Looks good: the viewport proof now skips only a stylesheet served from another origin, so any other read error fails it with its own message instead of being swallowed. An injected stylesheet read error fails the updated proof where the old walk let it pass, and without one the proof still passes in Chromium and WebKit. CI has not run yet: it starts once the pull request is ready for review and, because it comes from a fork, carries the ci:run label.

[Automated review]

@cixzhang cixzhang added the ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) label Oct 31, 2026
@cixzhang
cixzhang marked this pull request as ready for review October 31, 2026 01:08
@cixzhang
cixzhang merged commit 9a642cf into meta:main Oct 31, 2026
136 of 142 checks passed
@vjeux
vjeux deleted the test/lightbox-viewport-cross-origin-skip branch October 31, 2026 01:43

This branch was successfully deployed

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

Labels

ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants