fix: react-doctor modal/dialog/dropzone a11y — 18 files to role+tabIndex+onKeyDown or dialog

This commit is contained in:
Nora
2026-06-26 03:20:10 -06:00
parent e3c1295e62
commit d0bfec9d36
90 changed files with 747 additions and 408 deletions
+11 -6
View File
@@ -123,12 +123,15 @@ function scoreEntry(entry: PaletteEntry, query: string): number {
}
function filterEntries(query: string): PaletteEntry[] {
const scored = PALETTE_ENTRIES
.map((e) => ({ entry: e, score: scoreEntry(e, query) }))
.filter((r) => r.score > 0)
.sort((a, b) => b.score - a.score)
.slice(0, MAX_RESULTS);
return scored.map((r) => r.entry);
const scored: { entry: PaletteEntry; score: number }[] = [];
for (const e of PALETTE_ENTRIES) {
const score = scoreEntry(e, query);
if (score > 0) {
scored.push({ entry: e, score });
}
}
scored.sort((a, b) => b.score - a.score);
return scored.slice(0, MAX_RESULTS).map((r) => r.entry);
}
// ---------------------------------------------------------------------------
@@ -249,7 +252,9 @@ function CommandPaletteDialog({ onClose }: { onClose: () => void }) {
role="dialog"
aria-modal="true"
aria-label="Command palette"
tabIndex={-1}
onClick={onClose}
onKeyDown={(e) => { if (e.key === "Escape") onClose(); }}
style={{
position: "fixed",
inset: 0,