Add forced-colors support and contrast guidance
CI / Test and package (push) Failing after 49s

This commit is contained in:
2026-11-21 02:24:44 +01:00
parent db683819c9
commit 5e93a89b3a
15 changed files with 192 additions and 13 deletions
+76
View File
@@ -126,6 +126,41 @@
.catalog-hero__meta { align-items: center; }
.catalog-contrast-guide {
display: grid;
grid-template-columns: minmax(0, 1.2fr) minmax(14rem, 0.8fr);
gap: var(--frost-space-5) var(--frost-space-8);
margin-block: var(--frost-space-8) 0;
border-color: color-mix(in srgb, var(--frost-color-accent) 42%, var(--frost-color-border));
}
.catalog-contrast-guide h2 { margin: 0 0 var(--frost-space-3); font-size: var(--frost-font-size-xl); }
.catalog-contrast-guide p:not(.catalog-eyebrow) { margin: 0; color: var(--frost-color-text-muted); }
.catalog-contrast-guide ul { grid-column: 1 / -1; display: grid; gap: var(--frost-space-2); margin: 0; padding-inline-start: var(--frost-space-5); color: var(--frost-color-text-muted); }
.catalog-system-colors {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: var(--frost-space-2);
align-self: start;
}
.catalog-system-color {
display: grid;
min-height: 3.5rem;
place-items: center;
padding: var(--frost-space-2);
border: 1px solid var(--frost-color-border-strong);
border-radius: var(--frost-radius-sm);
font-size: 0.75rem;
font-weight: 750;
}
.catalog-system-color--canvas { background: var(--frost-color-surface); color: var(--frost-color-text); }
.catalog-system-color--text { background: var(--frost-color-text); color: var(--frost-color-bg); }
.catalog-system-color--button { background: var(--frost-color-surface-soft); color: var(--frost-color-text); }
.catalog-system-color--highlight { background: var(--frost-color-accent); color: var(--frost-color-on-accent); }
.catalog-empty {
padding: var(--frost-space-8);
border: 1px dashed var(--frost-color-border-strong);
@@ -286,6 +321,7 @@
@media (max-width: 48rem) {
.catalog-hero,
.catalog-contrast-guide,
.catalog-component__header,
.catalog-details { grid-template-columns: 1fr; }
.catalog-hero__actions { justify-self: start; }
@@ -293,4 +329,44 @@
.catalog-demo-grid { grid-template-columns: 1fr; }
.catalog-component__header { padding: var(--frost-space-5); }
}
@media (forced-colors: active) {
.catalog-sidebar,
.catalog-hero,
.catalog-contrast-guide,
.catalog-component,
.catalog-component__header,
.catalog-code,
.catalog-code__toolbar,
.catalog-a11y {
border-color: CanvasText;
background: Canvas;
color: CanvasText;
box-shadow: none;
}
.catalog-hero { background-image: none; }
.catalog-brand__mark { border: 1px solid Highlight; background: Highlight; color: HighlightText; forced-color-adjust: none; }
.catalog-eyebrow,
.catalog-hero__copy,
.catalog-sidebar__intro,
.catalog-nav__label,
.catalog-component__header p,
.catalog-live__label,
.catalog-a11y ul,
.catalog-contrast-guide p:not(.catalog-eyebrow),
.catalog-contrast-guide ul { color: CanvasText; }
.catalog-nav__link { color: LinkText; }
.catalog-nav__link:hover,
.catalog-nav__link:focus-visible { background: Highlight; color: HighlightText; forced-color-adjust: none; }
.catalog-live { background: Canvas; }
.catalog-copy { border-color: ButtonText; background: ButtonFace; color: ButtonText; forced-color-adjust: none; }
.catalog-copy:hover { background: Highlight; color: HighlightText; }
.catalog-code pre { background: Canvas; color: CanvasText; forced-color-adjust: none; }
.catalog-system-color { border-color: CanvasText; forced-color-adjust: none; }
.catalog-system-color--canvas { background: Canvas; color: CanvasText; }
.catalog-system-color--text { background: CanvasText; color: Canvas; }
.catalog-system-color--button { background: ButtonFace; color: ButtonText; }
.catalog-system-color--highlight { background: Highlight; color: HighlightText; }
}
}
+5
View File
@@ -103,6 +103,11 @@
<div class="catalog-details"><div class="catalog-code"><div class="catalog-code__toolbar"><span>HTML</span><button class="catalog-copy" type="button" data-copy-html>HTML kopieren</button></div><pre tabindex="0"><code data-snippet-code></code></pre></div><aside class="catalog-a11y"><h3>Accessibility</h3><ul><li>Bevorzuge das native <code>dialog</code>-Element und öffne es mit <code>showModal()</code>.</li><li>Verbinde den Dialog über <code>aria-labelledby</code> mit einer sichtbaren Überschrift.</li><li>Nach dem Schließen kehrt der Fokus zum auslösenden Button zurück.</li></ul></aside></div>
</section>
</div>
<aside class="catalog-contrast-guide frost-card" aria-labelledby="contrast-guide-title">
<div><p class="catalog-eyebrow">Forced Colors</p><h2 id="contrast-guide-title">Hoher Kontrast gehört zum Komponentenvertrag.</h2><p>Frost ordnet Flächen, Text, Controls, Links, Auswahl und deaktivierte Zustände den Systemfarben zu. Windows Contrast Themes und andere Forced-Colors-Umgebungen bleiben dadurch vollständig unter Kontrolle der Nutzenden.</p></div>
<div class="catalog-system-colors" aria-label="Verwendete Systemfarben"><span class="catalog-system-color catalog-system-color--canvas">Canvas</span><span class="catalog-system-color catalog-system-color--text">CanvasText</span><span class="catalog-system-color catalog-system-color--button">ButtonFace</span><span class="catalog-system-color catalog-system-color--highlight">Highlight</span></div>
<ul><li>Status nie nur über Farbe vermitteln; Frost ergänzt Unterschiede durch Rahmenstile und sichtbare Beschriftungen.</li><li>Eigene Komponenten sollten <code>forced-color-adjust: none</code> nur zusammen mit Systemfarben einsetzen.</li><li>Fokus, Auswahl, Fehler und deaktivierte Controls mit <code>forced-colors</code> und <code>prefers-contrast: more</code> prüfen.</li></ul>
</aside>
<footer class="catalog-footer">Frost bleibt CSS-only. Das Katalog-Script demonstriert ausschließlich Theme-, Copy- und zugängliches Interaktionsverhalten.</footer>
</main>
</div>