fix: add aria-labelledby to modal, htmlFor/id to form labels, autoFocus on open

This commit is contained in:
2026-03-30 19:27:21 -04:00
parent 8f2a46d3bb
commit 98c2b12340
2 changed files with 9 additions and 4 deletions
+7 -3
View File
@@ -56,13 +56,15 @@ export function FeedbackForm({ onSuccess }: { onSuccess?: () => void }) {
<form onSubmit={handleSubmit} className="space-y-5"> <form onSubmit={handleSubmit} className="space-y-5">
<div className="grid grid-cols-1 gap-5 sm:grid-cols-2"> <div className="grid grid-cols-1 gap-5 sm:grid-cols-2">
<div> <div>
<label className="mb-2 block text-[11px] font-semibold uppercase tracking-wider text-zinc-500"> <label htmlFor="feedback-category" className="mb-2 block text-[11px] font-semibold uppercase tracking-wider text-zinc-500">
Category Category
</label> </label>
<select <select
id="feedback-category"
value={category} value={category}
onChange={(e) => setCategory(e.target.value)} onChange={(e) => setCategory(e.target.value)}
disabled={status === 'loading'} disabled={status === 'loading'}
autoFocus
className="w-full appearance-none rounded-lg border border-zinc-800 bg-zinc-950 px-3 py-2.5 text-sm text-zinc-200 focus:border-amber-500/40 focus:outline-none disabled:opacity-50" className="w-full appearance-none rounded-lg border border-zinc-800 bg-zinc-950 px-3 py-2.5 text-sm text-zinc-200 focus:border-amber-500/40 focus:outline-none disabled:opacity-50"
> >
{CATEGORIES.map((c) => ( {CATEGORIES.map((c) => (
@@ -73,13 +75,14 @@ export function FeedbackForm({ onSuccess }: { onSuccess?: () => void }) {
</select> </select>
</div> </div>
<div> <div>
<label className="mb-2 block text-[11px] font-semibold uppercase tracking-wider text-zinc-500"> <label htmlFor="feedback-email" className="mb-2 block text-[11px] font-semibold uppercase tracking-wider text-zinc-500">
Email{' '} Email{' '}
<span className="font-normal normal-case tracking-normal text-zinc-600"> <span className="font-normal normal-case tracking-normal text-zinc-600">
(optional if you want a reply) (optional if you want a reply)
</span> </span>
</label> </label>
<input <input
id="feedback-email"
type="email" type="email"
value={email} value={email}
onChange={(e) => setEmail(e.target.value)} onChange={(e) => setEmail(e.target.value)}
@@ -91,10 +94,11 @@ export function FeedbackForm({ onSuccess }: { onSuccess?: () => void }) {
</div> </div>
<div> <div>
<label className="mb-2 block text-[11px] font-semibold uppercase tracking-wider text-zinc-500"> <label htmlFor="feedback-message" className="mb-2 block text-[11px] font-semibold uppercase tracking-wider text-zinc-500">
Message Message
</label> </label>
<textarea <textarea
id="feedback-message"
value={message} value={message}
onChange={(e) => setMessage(e.target.value.slice(0, 1000))} onChange={(e) => setMessage(e.target.value.slice(0, 1000))}
placeholder="What's on your mind?" placeholder="What's on your mind?"
+2 -1
View File
@@ -27,6 +27,7 @@ export function FeedbackModal({
className="fixed inset-0 z-50 flex items-center justify-center p-4" className="fixed inset-0 z-50 flex items-center justify-center p-4"
role="dialog" role="dialog"
aria-modal="true" aria-modal="true"
aria-labelledby="feedback-modal-title"
> >
<div <div
className="absolute inset-0 bg-black/70 backdrop-blur-sm" className="absolute inset-0 bg-black/70 backdrop-blur-sm"
@@ -35,7 +36,7 @@ export function FeedbackModal({
/> />
<div className="relative z-10 w-full max-w-lg rounded-2xl border border-zinc-800 bg-zinc-950 p-7 shadow-2xl"> <div className="relative z-10 w-full max-w-lg rounded-2xl border border-zinc-800 bg-zinc-950 p-7 shadow-2xl">
<div className="mb-5 flex items-center justify-between"> <div className="mb-5 flex items-center justify-between">
<h2 className="text-base font-bold text-white">Send Feedback</h2> <h2 id="feedback-modal-title" className="text-base font-bold text-white">Send Feedback</h2>
<button <button
onClick={onClose} onClick={onClose}
className="text-zinc-500 hover:text-zinc-300" className="text-zinc-500 hover:text-zinc-300"