--- name: glass-accessibility description: "Makes liquid glass style surfaces accessible: a solid tier for reduced transparency, more contrast and forced colors, an in-product solid toggle where browser support is missing, reduced motion, worst-case text contrast measured over the real rendered backdrop with scripts/glass_contrast.mjs, focus rings that survive any backdrop, and semantics for glass controls. Use when the user asks \"is my glass accessible\", \"text on frosted glass is hard to read\", \"glassmorphism contrast\", \"liquid glass and reduced transparency\", \"Apple glass accessibility\", \"WCAG on a glass effect\", or how glass should behave in high contrast mode. Do not use for general WCAG audits without glass, for picking glass parameters for looks alone (use glass-design or glass-optics), or for a full multi-area review (use glass-review)." --- # Glass accessibility Glass changes its own background every time the content beneath it moves, and its effects collide with user settings for transparency, contrast and motion. This skill gives every glass surface a designed solid fallback, wires the preferences that exist and covers the ones that do not, measures text contrast against the worst pixel actually rendered behind the text, and keeps focus and semantics intact. The worst-case method is this plugin's engineering inference from WCAG 1.4.3 and 1.4.11, not a W3C procedure; say so in reports. ## Start here 1. **Inventory** every glass surface: variant (clear or regular, tier per engine), the text and controls on it, the content it can float over (photos, video, user content, scrolling feeds), and its states (hover, pressed, selected, open). 2. **Find existing handling**: `rg -n "prefers-reduced-transparency|prefers-contrast|forced-colors|prefers-reduced-motion|accessibilityReduce|colorSchemeContrast" .` and note any user setting for themes or contrast that a solid toggle can join. 3. **Find the tokens** for an opaque surface, its text color and its border in the existing design system. The solid tier uses these, not new colors. 4. **Check support for the engines you ship** in [browser-support.md](../../references/browser-support.md#1-feature-matrix), and read the caveat below before relying on any media query. 5. Write the preference behaviour and acceptance checks into [glass-spec.md](../../templates/glass-spec.md). ## Preferences and their support | Preference | Web signal | Support caveat (checked 2026-11-05) | Required behaviour | | --- | --- | --- | --- | | Reduced transparency | `prefers-reduced-transparency: reduce` | Chromium supports it; Firefox only behind a pref. **Not supported in Safari as of the 2026-11-05 snapshot**: MDN browser-compat-data records no Safari version, and the WebKit implementation bug 175497 (https://bugs.webkit.org/show_bug.cgi?id=175497) is still NEW. | go solid; **also ship an in-product "Solid surfaces" toggle** | | More contrast | `prefers-contrast: more` | Chrome 96, Firefox 101, Safari 14.1 | go solid or near-solid with a stronger border; also serves as the Safari proxy for reduced transparency | | Forced colors | `forced-colors: active` | Chrome 89, Firefox 89; Safari 16 always matches `none` | system colors, a real border, no filters, decorative layers hidden | | Reduced motion | `prefers-reduced-motion: reduce` | Chrome 74, Firefox 63, Safari 10.1 | no stretch, lean or travel; morphs become fades; feedback stays | | Apple Reduce Transparency, Increase Contrast, Reduce Motion | `\.accessibilityReduceTransparency`, `\.colorSchemeContrast`, `\.accessibilityReduceMotion` | system glass adapts; your own overlays do not | see the `glass-native` skill | Because Safari users cannot reach the solid tier through `prefers-reduced-transparency`, never let a media query be the only path to opaque surfaces. The toggle is required in every web product that ships glass, whatever the media query does, and stays required when Safari ships the query, since users on older versions keep the gap. ## Build the solid tier and the toggle The toggle has one name everywhere in this plugin: the attribute `data-glass-surfaces="solid"` on the `` element. The tokens are the ones [glass-web](../glass-web/SKILL.md#tier-order-solid-then-frost-then-refract) defines on `:root`; if glass-web already wrote this CSS, check it rather than adding a second copy. ```css :root { --glass-solid: Canvas; /* map each to a design-system token */ --glass-solid-ink: CanvasText; --glass-solid-line: color-mix(in srgb, CanvasText 30%, transparent); } .glass[data-glass-tier="solid"], :root[data-glass-surfaces="solid"] .glass { backdrop-filter: none; -webkit-backdrop-filter: none; filter: none; background: var(--glass-solid); color: var(--glass-solid-ink); border: 1px solid var(--glass-solid-line); } @media (prefers-reduced-transparency: reduce), (prefers-contrast: more) { .glass { backdrop-filter: none; -webkit-backdrop-filter: none; filter: none; background: var(--glass-solid); color: var(--glass-solid-ink); border: 1px solid var(--glass-solid-line); } } ``` Swap `Canvas` and `CanvasText` for your own opaque tokens on `:root`, never on `.glass`, so every rule reads the same values. Then: - Put the toggle in settings with a plain label ("Solid surfaces", "Reduce transparency"), store the choice, and set the attribute from a small inline script in `
` before first paint, so the page never flashes glass first. Guard storage access with try and catch: ```html ``` - With this plugin's engine, the attribute is all you need: the engine watches it and switches every instance to `solid` live, with the reason "the user turned on solid surfaces". It also drops to `solid` for forced colors, reduced transparency and more contrast ([glass-lab README](../../examples/glass-lab/README.md#solid-surfaces-setting)). Other JavaScript renderers must watch the same attribute and tear down their effect. Style `[data-glass-tier="solid"]` with the opaque tokens, because the engine's stylesheet removes the backdrop filter but does not paint a background. - Forced colors: `background: Canvas; color: CanvasText; border: 1px solid CanvasText`, buttons on `ButtonFace` and `ButtonText`, selected states on `Highlight`, and decorative canvases and overlays `display: none` ([accessibility.md](../../references/accessibility.md#6-forced-colors)). - Rims drawn only with `box-shadow` or gradients vanish in forced colors; always add a real border there. ## Measure worst-case contrast Measuring the text color against the tint alone, or one screenshot, certifies nothing. Measure what the text actually sits on, at its worst: Run the plugin's script from the user's project directory by path. `