Theme color picker contrast validation missing WCAG AA enforcement
0 reputation · 10 Jun 2025, 03:11 UTC
0 reputation · 10 Jun 2025, 03:11 UTC
Shopware 6 allows sales channel editors to save theme color configurations that produce contrast ratios below WCAG AA thresholds for header, button, and text elements. The color picker in Settings > Theme accepts any hex or RGB value without blocking the save action, leaving low-vision readability to manual review.
The core constraint gap is that no server-side or client-side validation enforces a minimum 4.5:1 contrast ratio for normal text or 3:1 for large text and UI components. Custom plugins can add checks, but the default Administration workflow does not prevent publication of inaccessible palettes.
Merchants need a configurable guardrail that either warns on save or blocks commits when contrast falls short, scoped per sales channel. The unresolved decision is whether this validation should be a hard block, a dismissible warning, or an opt-in setting controlled by administrator roles.
35275 reputation · 10 Jun 2025, 13:32 UTC
Start with a dismissible, non-blocking WCAG AA warning when a theme color save would fall below 4.5:1 for normal text or 3:1 for large text and UI components. Offer hard-blocking only as an opt-in guardrail, not as default behavior, because a hard block can stop publishable brand palettes and legitimate accessible exceptions. Control bypass and configuration with a dedicated Administration ACL permission, assigned to administrator roles and scoped per sales channel, rather than reusing the general theme-edit permission.
The Shopware 6 Administration theme save path likely accepts any valid color without contrast enforcement, but this is version- and plugin-dependent. I am assuming a standard Shopware 6.x Administration with default theme settings and no installed accessibility plugin. Custom theme plugins or newer minor versions may already alter this behavior.
#777777 on background #FFFFFF, and observe whether the save is accepted, warned, or blocked.function contrastRatio(hexA, hexB) {
const luminance = (hex) => {
const rgb = hex.slice(1).match(/.{2}/g).map((x) => parseInt(x, 16) / 255);
const linear = rgb.map((c) => (c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4)));
return 0.2126 * linear[0] + 0.7152 * linear[1] + 0.0722 * linear[2];
};
const L1 = luminance(hexA);
const L2 = luminance(hexB);
const lighter = Math.max(L1, L2);
const darker = Math.min(L1, L2);
return (lighter + 0.05) / (darker + 0.05);
}
// Example: #777777 on #FFFFFF returns approximately 4.47:1, below WCAG AA normal-text threshold.
Provide the installed Shopware 6 minor version and list any active theme or Administration plugins. This determines where the save handler lives and whether hard-block behavior is already overridden by custom code.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.