-
Notifications
You must be signed in to change notification settings - Fork 0
🎨 Palette: [UX improvement] Improve keyboard accessibility for form controls #55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -295,6 +295,7 @@ export function PlaygroundView({ | |
| <div className="mb-6 grid gap-3 md:grid-cols-3"> | ||
| <Control label="Guide"> | ||
| <select | ||
| aria-label="Guide" | ||
| className="pp-select" | ||
| onChange={(e) => setGuideSlug(e.target.value)} | ||
| value={guideSlug} | ||
|
|
@@ -309,6 +310,7 @@ export function PlaygroundView({ | |
|
|
||
| <Control label="Preset"> | ||
| <select | ||
| aria-label="Preset" | ||
| className="pp-select" | ||
|
Comment on lines
312
to
314
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| onChange={(e) => setPresetSlug(e.target.value as UseCase | "")} | ||
| value={presetSlug} | ||
|
|
@@ -341,7 +343,8 @@ export function PlaygroundView({ | |
| <div className="grid gap-5 md:grid-cols-2"> | ||
| <Panel label="Input"> | ||
| <textarea | ||
| className="min-h-[220px] w-full resize-y bg-transparent text-sm focus:outline-none" | ||
| aria-label="Input" | ||
| className="min-h-[220px] w-full resize-y bg-transparent text-sm focus:outline-none focus-visible:outline-[var(--strand-color-accent-lede)] focus-visible:outline-2 focus-visible:outline-offset-2" | ||
| onChange={(e) => setInput(e.target.value)} | ||
| placeholder="Paste a customer message, a prompt, a paragraph to rewrite…" | ||
| style={{ color: "var(--strand-color-ink-primary)" }} | ||
|
|
@@ -647,6 +650,11 @@ export function PlaygroundView({ | |
| border-radius: 0.375rem; | ||
| padding: 0.5rem 0.75rem; | ||
| font-size: 0.875rem; | ||
| outline: none; | ||
| } | ||
| .pp-select:focus-visible { | ||
| outline: 2px solid var(--strand-color-accent-lede); | ||
| outline-offset: 2px; | ||
| } | ||
|
Comment on lines
+653
to
658
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Setting |
||
| `}</style> | ||
| </section> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the
<select>element is already wrapped inside a<label>element by theControlcomponent, it is implicitly associated and will be correctly announced by screen readers. Adding a hardcodedaria-labelis redundant and introduces a maintenance risk where the visual label and the accessible name could desync (violating WCAG 2.5.3 Label in Name if they diverge).