File tree Expand file tree Collapse file tree
apps/web/src/components/settings Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import { useState } from "react" ;
1+ import { useId , useState } from "react" ;
22import { normalizeProviderIconUrl , type ProviderDriverKind } from "@t3tools/contracts" ;
33import { Input } from "../ui/input" ;
44import { Button } from "../ui/button" ;
@@ -11,6 +11,7 @@ export function ProviderIconUrlInput(props: {
1111 readonly disabled ?: boolean ;
1212 readonly onCommit : ( value : string ) => void ;
1313} ) {
14+ const errorId = useId ( ) ;
1415 const [ draft , setDraft ] = useState < { saved : string | undefined ; value : string } | null > ( null ) ;
1516 const value = draft !== null && draft . saved === props . value ? draft . value : ( props . value ?? "" ) ;
1617 const invalid = value . trim ( ) !== "" && normalizeProviderIconUrl ( value ) === null ;
@@ -29,6 +30,7 @@ export function ProviderIconUrlInput(props: {
2930 < Input
3031 aria-label = "Instance icon URL"
3132 aria-invalid = { invalid || undefined }
33+ aria-describedby = { invalid ? errorId : undefined }
3234 size = "sm"
3335 type = "url"
3436 value = { value }
@@ -57,7 +59,9 @@ export function ProviderIconUrlInput(props: {
5759 </ Button >
5860 </ div >
5961 { invalid ? (
60- < p className = "text-xs text-destructive" > Enter an HTTPS image URL without credentials.</ p >
62+ < p id = { errorId } role = "alert" className = "text-xs text-destructive" >
63+ Enter an HTTPS image URL without credentials.
64+ </ p >
6165 ) : null }
6266 </ div >
6367 ) ;
You can’t perform that action at this time.
0 commit comments