Repository navigation
Conversation
…very shipped theme A browser test opens a captioned Lightbox in each shipped theme and Core's default tokens, light and dark, and measures the caption's text against the backdrop beside its first line. Lightbox AR9 names the check. It fails on main: in light mode the light caption text sits on the light backdrop.
The caption's light text sat on a light theme's translucent backdrop, as low as 2.6:1. It now sits on the counter's dark translucent backing, an inline span cloned per line, so the caption box keeps its size and place. The unit tests find the caption by its box.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec 7ba2553 |
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| Lightbox · Storybook | 122.7 kB (+39 B) · 10.6 kB CSS (+31 B) | 3,430 (+18) | ✓ · ✓ · ✓ |
| lab/Comments | 351.5 kB (+30 B) · 2.5 kB CSS (0) | — | — · — · — |
| lab/CommentThread | 344.5 kB (+24 B) · 2.4 kB CSS (0) | — | — · — · — |
Package size: @astryxdesign/core 7.22 MB packed (+248 B); no new dependencies.
API changes: none in this pull request
Committed API report behind this build: cli 29 rows, core 36 rows, theme-butter 1 row, theme-y2k 1 row; run pnpm api:report.
Touched components checked; add ci:run-visual or ci:run-rtl to run the full suites.
Generated by PR Enrichment workflow | View full report
… padding widens it
|
/approve-spec 19d939e |
There was a problem hiding this comment.
Requesting changes. The caption backing fixes light-mode contrast: the new browser test passes in every shipped theme and Core's default tokens, light and dark, and fails on main in seven light cases. One wording fix remains.
- The changeset says the caption "keeps its height and place" and keeps 4.5:1 "in every theme", but the backing's per-line padding takes 16px of room from every line, so a caption can wrap one line sooner (the
With Captionstory on a 402px phone goes from two lines to three in Matcha and Y2K, and the photo moves up 14px), and contrast is proven for the shipped themes only, so please reword it (for example "in every shipped theme, light and dark … each line gains the backing's inline padding, so a caption can grow 16px wider or wrap one line sooner") and drop "and place" from the comment atLightbox.tsx:450, or make the height claim true in code.
Optional: captionBacking repeats counterBacking's declarations, and composing the two keeps the shared backing in one place.
[Automated review]
…set names the wrap and the shipped themes The caption's span now takes the counter's backing style plus a per-line break, so the backing lives in one place. The Changeset says the contrast holds in every shipped theme, light and dark, and that the backing's inline padding can make a caption 16px wider or wrap one line sooner.
|
/approve-spec a9d2374 |
There was a problem hiding this comment.
Approved pending CI: the required build, test and docsite-test checks are deferred on this push and run before merge.
The caption backing fixes light-mode contrast: the new browser test passes in every shipped theme and Core's default tokens, light and dark, and fails on main in seven light cases. The changeset and the code comment now describe the wider caption and the possible extra wrapped line.
Optional:
- The changeset's "16px wider" holds where
--spacing-2is 8px; Matcha and Y2K set it to 0.75rem, so each line there gains 24px, and naming the padding instead of a number keeps the note true in every theme. - The description's What changes bullet for
Lightbox.tsxstill says the caption "keeps its height and place".
[Automated review]
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [fix] `Lightbox`'s caption text keeps a 4.5:1 contrast ratio in every shipped theme, light and dark. In light mode the caption's light text sat on the light translucent backdrop, as low as 2.6:1. It now sits on the same dark translucent backing as the counter, line by line; each line gains the backing's inline padding, so a caption can grow 16px wider or wrap one line sooner. |
There was a problem hiding this comment.
Non-blocking: "16px wider" holds where --spacing-2 is 8px. Matcha and Y2K set --spacing-2 to 0.75rem (matchaTheme.ts:260, y2kTheme.ts:140), so there each line gains 24px, which is also why the With Caption story wraps to a third line on a phone in those themes. A wording that holds in every theme: "each line gains the backing's inline padding at both ends, so a caption can grow wider or wrap one line sooner."
Two browser proofs found the caption by its text. With the text now on a backing span inside the caption box, that matched the span, whose top sits below the box's 8px top padding, so the gap read 10-12px where the box itself still meets the photo. The proofs now measure the caption box, which is what they assert about; the layout is unchanged.
|
/approve-spec 33484d6 |
There was a problem hiding this comment.
Approved pending CI: CI's required checks have not run on this head yet.
The caption backing fixes light-mode contrast: the new browser test passes in every shipped theme and Core's default tokens, light and dark, and fails on main in seven light cases. The two caption placement proofs now measure the caption box, so they pass with the backing span.
Optional:
- The changeset's "16px wider" holds where
--spacing-2is 8px; Matcha and Y2K set it to 0.75rem, so each line there gains 24px, and naming the padding instead of a number keeps the note true in every theme.
[Automated review]
There was a problem hiding this comment.
Requesting changes: one required check fails on this head.
- Found by CI: the required
lintcheck fails becauseLightboxFinePointer.a11y.browser.spec.ts:163passes the literalhasText: 'A winding path through the forest', which@astryx/no-hardcoded-i18n-stringreports as an error in CI;dialog.locator('[data-lightbox-caption]')finds the story's one caption, as the new AR9 test does, and lints clean.
The caption backing itself does what AR9 now asks: the new browser test passes in every shipped theme and Core's default tokens, light and dark, and fails on main in the seven light cases that sit under 4.5:1. Optional: the changeset's "16px wider" is 24px in Matcha and Y2K, as the earlier inline note on that line says.
| // The caption's box, not its text: the text sits on a backing inside the | ||
| // box's top padding. | ||
| const caption = dialog.locator('[data-lightbox-caption]', { | ||
| hasText: 'A winding path through the forest', |
There was a problem hiding this comment.
Found by CI: this literal fails the required lint check. @astryx/no-hardcoded-i18n-string reports hasText strings as errors in CI's strict mode, and it does not skip this file (it skips only __tests__/ and *.test.*). The zoom-with-caption story shows one caption, so this lints clean and measures the same box:
const caption = dialog.locator('[data-lightbox-caption]');|
(Posted by Cindy's agent.) Closing as superseded: fixed on main by #9810 and #10284. The caption sits on its backing and measures ≥4.5:1 in every shipped theme, light and dark, in Chromium and WebKit, and main's LightboxZoom interaction tests already assert the 4.5:1 caption contrast (in the band, open, over a white page and photo, and in a gallery band). |
User impact
In light mode, a Lightbox caption's white text sat on the light translucent backdrop, so people with low vision could struggle to read it: as low as 2.6:1 against the 4.5:1 that WCAG 1.4.3 requires for 17px text. The caption now sits on the counter's dark translucent backing, line by line, and every shipped theme measures 6.8:1 or better, light and dark. Contrast is proven for the shipped themes and Core's default tokens.
What changes
Lightbox.tsx: the caption's content is wrapped in an inline backing span with the counter's existing backing (--color-on-lightat 75%, a full radius,--spacing-2inline padding), cloned per line withbox-decoration-break. Each line gains the backing's 8px inline padding on each side, so a caption grows 16px wider, or wraps one line sooner when it's near the width limit (see the phone case below). The span composes the counter's backing style, so the backing lives in one place. The viewer backdrop is unchanged.Lightbox.spec.mdAR9: the caption's text keeps 4.5:1 over the backdrop in every shipped theme, light and dark. The verification row names the new browser test.LightboxZoom.interaction.browser.spec.ts: a browser test per theme (all shipped themes plus Core's default tokens) and mode measures the caption's text against the backdrop beside its first line, and fails under 4.5:1. It fails on main in light mode.Lightbox.test.tsx: the unit tests find the caption by its box, since the text now sits in the backing span.Evidence: real Chrome 157, same measurement as the new test
The caption's text colour against the lightest backdrop pixel just beside its first line, on Storybook's
Lightbox / With Caption, before (main) and after (this branch):Desktop (1280×800) and mobile (390×844) give the same ratios.
Neutral, light
Neutral, dark
Core default tokens, light (the lowest before)
Blank backdrop and zoomed photo, two themes (desktop)
Blank backdrop: the caption under a fitted photo. Zoomed photo: a double click zooms the photo, which fills the stage above the caption.
Blank backdrop, Neutral
Blank backdrop, Butter
Zoomed photo, Neutral
Zoomed photo, Butter
Layout change on a phone: a caption can wrap one line sooner
On a 402px-wide phone in light mode, the
With Captionstory's caption goes from 2 lines to 3 in Matcha and Y2K: the caption grows 28px (68 to 96px) and the photo, centred with it, moves up 14px. In Neutral it stays at 2 lines at 402px. At 390px it's Neutral's caption that goes from 2 lines to 3, while Matcha and Y2K already wrap to 3 lines before the change. So the extra line depends on the theme's font and the screen width.Checks
check:changesetsandcheck:knowledgepass.Writing rubric results
component:LightboxAR9, beside the controls' contrast it shares a backing with.