fix: restore light-mode demo code contrast - #13
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR restores readable contrast for the demo’s copy-ready code snippets in light mode by preventing inline-code styling from overriding the <pre> surface color, and it hardens GitHub Pages deployments by fingerprinting key assets based on deployed content to avoid stale-cache masking of hotfixes.
Changes:
- Ensure copy-ready snippet
<code>elements inherit the<pre>foreground on the dark code surface (fixing light-mode contrast regression). - Add rendered (browser) WCAG AA contrast assertions for both code snippets across light/dark/high-contrast demo modes.
- Fingerprint GitHub Pages demo assets (
demo.css,demo.js, anddist/layout-style-css.css) using a content-derived hash and assert the generated artifact uses those URLs.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/pages-artifact.test.mjs | Verifies Pages index.html references content-fingerprinted asset URLs derived from the deployed artifact. |
| test/demo-smoke.test.mjs | Adds browser-rendered contrast checks for the two copy-ready snippet blocks in all demo modes. |
| scripts/build-pages.mjs | Implements content-derived fingerprinting for versioned Pages assets during artifact generation. |
| demo/demo.css | Forces snippet <code> to inherit <pre> color to prevent inline-code paint from reducing contrast. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
Root cause
UI Style Kit applies inline-code paint directly to nested
codeelements. In light mode that dark foreground overrode the light foreground on the demo's darkpresurface, producing approximately 1.04:1 contrast.User impact
The Imports and Markup snippets are readable in every demo mode. Light-mode code contrast is approximately 14.48:1, and future Pages asset changes receive new cache-busting URLs automatically.
Verification
npm.cmd run check:fullgit diff --check