feat(a11y): enhance accessibility of password gate form (#46)

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
This commit is contained in:
Ralksta
2026-03-27 10:36:22 +01:00
committed by GitHub
parent 5ebc900851
commit c8f75e4615

View File

@@ -51,6 +51,7 @@ export default function PasswordGate({ slug, title }: PasswordGateProps) {
<form onSubmit={handleSubmit} className={styles.form}>
<input
id="password-input"
type="password"
value={password}
onChange={(e) => setPassword(e.target.value)}
@@ -59,13 +60,20 @@ export default function PasswordGate({ slug, title }: PasswordGateProps) {
className={styles.input}
autoFocus
required
disabled={loading}
aria-invalid={!!error}
aria-describedby={error ? 'password-error' : undefined}
/>
<button type="submit" className={styles.button} disabled={loading}>
{loading ? 'Verifying…' : 'Enter'}
</button>
</form>
{error && <p className={styles.error}>{error}</p>}
{error && (
<p id="password-error" className={styles.error} role="alert" aria-live="polite">
{error}
</p>
)}
</div>
</div>
);