Skip to content

Commit 7dbd712

Browse files
Ajit Pratap Singhclaude
authored andcommitted
fix(a11y): fix 4 Lighthouse accessibility failures blocking CI
Based on Lighthouse report artifact analysis, 4 weighted audits were failing on /playground: 1. aria-input-field-name (weight=7): CodeMirror's cm-content[role=textbox] had no accessible name. Fixed with EditorView.contentAttributes.of() to pass aria-label directly to the cm-content element. 2. color-contrast (weight=7): oneDark theme's coral (#e06c75) on #282c34 background yields 4.38:1 ratio (fails WCAG AA 4.5:1). Override with custom HighlightStyle (#e87980 → ~5.07:1 contrast) placed before oneDark for higher CM6 precedence. 3. heading-order (weight=3): Footer h3 elements skipped h2 after h1 in Playground, failing sequential heading order. Changed footer section labels from h3 to h2. 4. image-redundant-alt (weight=1): Logo images had alt="GoSQLX" while parent links also contained "GoSQLX" text (redundant). Changed to alt="" (decorative) in Navbar and Footer. Also adds @lezer/highlight as direct dependency (was transitive). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent b3a6848 commit 7dbd712

4 files changed

Lines changed: 14 additions & 3 deletions

File tree

website/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
},
1414
"dependencies": {
1515
"@codemirror/lang-sql": "^6.10.0",
16+
"@lezer/highlight": "^1.2.3",
1617
"@codemirror/state": "^6.6.0",
1718
"@codemirror/theme-one-dark": "^6.1.3",
1819
"@codemirror/view": "^6.40.0",

website/src/components/layout/Footer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function Footer() {
3838
{/* Logo column */}
3939
<div className="col-span-2 md:col-span-1">
4040
<Link href="/" className="flex items-center gap-2.5">
41-
<Image src="/images/logo.webp" alt="GoSQLX" width={28} height={28} />
41+
<Image src="/images/logo.webp" alt="" width={28} height={28} />
4242
<span className="text-lg font-semibold text-white">GoSQLX</span>
4343
</Link>
4444
<p className="mt-3 text-sm text-zinc-400 max-w-xs">
@@ -49,7 +49,7 @@ export function Footer() {
4949
{/* Link columns */}
5050
{Object.entries(FOOTER_LINKS).map(([category, links]) => (
5151
<div key={category}>
52-
<h3 className="text-sm font-medium text-zinc-300 mb-3">{category}</h3>
52+
<h2 className="text-sm font-medium text-zinc-300 mb-3">{category}</h2>
5353
<ul className="space-y-2">
5454
{links.map((link) => (
5555
<li key={link.label}>

website/src/components/layout/Navbar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export function Navbar() {
6060
<nav className="mx-auto max-w-7xl flex items-center justify-between px-4 sm:px-6 lg:px-8 h-16">
6161
{/* Logo */}
6262
<Link href="/" className="flex items-center gap-2.5 shrink-0">
63-
<Image src="/images/logo.webp" alt="GoSQLX" width={32} height={32} priority />
63+
<Image src="/images/logo.webp" alt="" width={32} height={32} priority />
6464
<span className="text-lg font-semibold text-white">GoSQLX</span>
6565
</Link>
6666

website/src/components/playground/SqlEditor.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,15 @@ import {
99
syntaxHighlighting,
1010
defaultHighlightStyle,
1111
bracketMatching,
12+
HighlightStyle,
1213
} from "@codemirror/language";
14+
import { tags } from "@lezer/highlight";
15+
16+
// Override oneDark's coral (#e06c75) which fails WCAG AA (4.38:1 on #282c34).
17+
// #e87980 achieves ~5.07:1 contrast against #282c34.
18+
const accessibleHighlight = HighlightStyle.define([
19+
{ tag: [tags.name, tags.deleted, tags.character, tags.propertyName, tags.macroName], color: "#e87980" },
20+
]);
1321

1422
interface SqlEditorProps {
1523
value: string;
@@ -88,12 +96,14 @@ export default function SqlEditor({
8896
const extensions = [
8997
baseTheme,
9098
minHeightTheme,
99+
syntaxHighlighting(accessibleHighlight),
91100
oneDark,
92101
sql(),
93102
syntaxHighlighting(defaultHighlightStyle, { fallback: true }),
94103
bracketMatching(),
95104
history(),
96105
keymap.of([...defaultKeymap, ...historyKeymap]),
106+
EditorView.contentAttributes.of({ "aria-label": ariaLabel }),
97107
updateListener,
98108
];
99109

0 commit comments

Comments
 (0)