Repository navigation
fix(Lightbox): the viewer fits the visible viewport, so Safari's toolbar no longer covers its caption - #8732
Merged
Merged
Conversation
…bar no longer covers its caption The viewer's dialog was 100vh tall. In Mobile Safari 100vh is the large viewport, measured with the toolbars retracted, so the dialog ran under the bottom toolbar and hid a gallery's caption (iOS 26.2, iPhone 17 Pro: 714 pt visible, the caption at 718-754). It is now 100dvh, the dynamic viewport, with 100vh where an engine lacks dvh. A browser spec requires the declared dvh: no desktop or emulated engine shrinks the dynamic viewport.
vjeux
requested review from
cixzhang,
imdreamrunner and
josephfarina
as code owners
October 27, 2026 18:49
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
AI review status for this pull request.
|
github-actions
Bot
requested review from
cvkxx,
ernestt,
kentonquatman and
rubyycheung
October 27, 2026 18:49
Contributor
There was a problem hiding this comment.
Automated review found no blocking issues: sizing the Lightbox dialog with 100dvh, falling back to 100vh, keeps the caption above Mobile Safari's bottom toolbar without changing any API or how other browsers render the viewer. The iPhone simulator measurements in the description are the real-browser evidence this fix needs, and the new browser spec catches a return to 100vh. Nothing further is needed from you.
[Automated review]
3 tasks done
cixzhang
pushed a commit
that referenced
this pull request
Oct 31, 2026
#9064) ## 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 - [x] No intended public API, product behavior, visual direction, or policy change. - [x] Product changes discovered during the work were removed or split. - [x] Public text and artifacts contain no internal Meta context. ## Testing Local gates at fd830f7 (on main d73908f): - `pnpm check:repo`, `pnpm typecheck` (0 errors), ESLint and Prettier on the spec, the root build and the Storybook build pass. - `pnpm test:ui`: 16,446 tests pass. `pnpm test:node`: 14,502 pass; its 4 failures, in `story-tree.test.ts` and the release `cache.test.mjs`, are independent of this change (#8509, #8520). - The spec passes 2 of 2 in Chromium and 2 of 2 in WebKit; the injection runs above are in Chromium.
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User impact
On an iPhone, Safari's bottom toolbar covers the bottom of an open Lightbox. A photo tall enough to fill the viewer pushes its caption there, unseen, and a tap where it sits reaches Safari instead. Measured in Mobile Safari, iOS 26.2, iPhone 17 Pro, on main's gallery story with a 1:3 portrait photo: the visible viewport is 714 pt, the viewer 754 pt, and the caption spans 718–754.
Problem and solution fit
height: 100vh. In Mobile Safari100vhis the large viewport, measured with the toolbars retracted, so the dialog runs past the visible area by the bottom toolbar's height.The fix sizes the dialog to the dynamic viewport,
100dvh: the height the browser shows. An engine withoutdvhkeeps100vh.Expected behavior and authority
Lightbox.doc.mjsdocuments the caption as "displayed below the active media". The draftcomponent:Lightboxrecord describes "a full-viewport viewer" (context only: draft, not authority). CSS Values 4 definesdvhas the dynamic viewport, the size with the browser's current toolbars.Smallest restoration
One declaration,
height: stylex.firstThatWorks('100dvh', '100vh'). The width stays100vw; no other style, API or behavior changes.Evidence
100dvhequals100vh; the Lightbox browser specs and unit tests pass unchanged.LightboxViewport.a11y.browser.spec.tsrequires the viewer to declare100dvh. On main it fails in both engines, reading["100vh"]. No desktop or emulated engine shrinks the dynamic viewport (Chromium's small-viewport override moves onlysvh;dvh,lvhandvhstay at the window height), so the simulator measurement above proves the geometry.Scope
Testing
pnpm exec playwright test --config playwright.config.ts packages/core/src/Lightbox/*.a11y.browser.spec.tson the built Storybook: Chromium 3/3, WebKit 3/3. The new spec failed on main in both engines, reading["100vh"].pnpm vitest run packages/core/src/Lightbox/: 61 pass. Core typecheck: 0 errors.CI=trueeslint overpackages/core/src/Lightbox: 0 problems.pnpm check:repopasses; the CI duration guard passes.visualViewport.height, with the gallery story's wide photo (caption at 493–529 on main, 473–509 here) and with a 1:3 portrait photo.import {Lightbox}, gzip): JS 52,567 → 52,567 B, CSS 10,015 → 10,022 B.