1- import { useState } from "react" ;
1+ import { useId , useState } from "react" ;
22import { useFetcher } from "@remix-run/react" ;
33import type { ActionFunctionArgs , LoaderFunctionArgs } from "@remix-run/server-runtime" ;
44import { redirect } from "@remix-run/server-runtime" ;
@@ -313,6 +313,7 @@ function DeleteButton({ name }: { name: string }) {
313313
314314function EditButton ( { name, organizationIds } : { name : string ; organizationIds : string [ ] } ) {
315315 const [ open , setOpen ] = useState ( false ) ;
316+ const fieldId = useId ( ) ;
316317 const fetcher = useFetcher < { success ?: boolean ; error ?: string } > ( ) ;
317318 const isSubmitting = fetcher . state !== "idle" ;
318319
@@ -336,8 +337,11 @@ function EditButton({ name, organizationIds }: { name: string; organizationIds:
336337 < input type = "hidden" name = "key" value = { name } />
337338
338339 < div className = "space-y-1.5" >
339- < label className = "text-xs font-medium text-text-dimmed" > Key</ label >
340+ < label htmlFor = { `${ fieldId } -key` } className = "text-xs font-medium text-text-dimmed" >
341+ Key
342+ </ label >
340343 < Input
344+ id = { `${ fieldId } -key` }
341345 name = "_key_display"
342346 value = { name }
343347 readOnly
@@ -347,10 +351,14 @@ function EditButton({ name, organizationIds }: { name: string; organizationIds:
347351 </ div >
348352
349353 < div className = "space-y-1.5" >
350- < label className = "text-xs font-medium text-text-dimmed" >
354+ < label
355+ htmlFor = { `${ fieldId } -organizationIds` }
356+ className = "text-xs font-medium text-text-dimmed"
357+ >
351358 Organization IDs < span className = "text-rose-400" > *</ span >
352359 </ label >
353360 < Input
361+ id = { `${ fieldId } -organizationIds` }
354362 name = "organizationIds"
355363 defaultValue = { organizationIds . join ( ", " ) }
356364 placeholder = "clxxxxx, clyyyyy, clzzzzz"
@@ -394,6 +402,7 @@ function AddDataStoreDialog({
394402 onOpenChange : ( open : boolean ) => void ;
395403} ) {
396404 const fetcher = useFetcher < { success ?: boolean ; error ?: string } > ( ) ;
405+ const fieldId = useId ( ) ;
397406 const isSubmitting = fetcher . state !== "idle" ;
398407
399408 // Close dialog on success
@@ -412,10 +421,11 @@ function AddDataStoreDialog({
412421 < input type = "hidden" name = "_action" value = "add" />
413422
414423 < div className = "space-y-1.5" >
415- < label className = "text-xs font-medium text-text-dimmed" >
424+ < label htmlFor = { ` ${ fieldId } -key` } className = "text-xs font-medium text-text-dimmed" >
416425 Key < span className = "text-rose-400" > *</ span >
417426 </ label >
418427 < Input
428+ id = { `${ fieldId } -key` }
419429 name = "key"
420430 placeholder = "e.g. hipaa-clickhouse-us-east"
421431 variant = "medium"
@@ -428,10 +438,11 @@ function AddDataStoreDialog({
428438 </ div >
429439
430440 < div className = "space-y-1.5" >
431- < label className = "text-xs font-medium text-text-dimmed" >
441+ < label htmlFor = { ` ${ fieldId } -kind` } className = "text-xs font-medium text-text-dimmed" >
432442 Kind < span className = "text-rose-400" > *</ span >
433443 </ label >
434444 < Input
445+ id = { `${ fieldId } -kind` }
435446 name = "kind"
436447 value = "CLICKHOUSE"
437448 readOnly
@@ -441,10 +452,14 @@ function AddDataStoreDialog({
441452 </ div >
442453
443454 < div className = "space-y-1.5" >
444- < label className = "text-xs font-medium text-text-dimmed" >
455+ < label
456+ htmlFor = { `${ fieldId } -organizationIds` }
457+ className = "text-xs font-medium text-text-dimmed"
458+ >
445459 Organization IDs < span className = "text-rose-400" > *</ span >
446460 </ label >
447461 < Input
462+ id = { `${ fieldId } -organizationIds` }
448463 name = "organizationIds"
449464 placeholder = "clxxxxx, clyyyyy, clzzzzz"
450465 variant = "medium"
@@ -454,10 +469,14 @@ function AddDataStoreDialog({
454469 </ div >
455470
456471 < div className = "space-y-1.5" >
457- < label className = "text-xs font-medium text-text-dimmed" >
472+ < label
473+ htmlFor = { `${ fieldId } -connectionUrl` }
474+ className = "text-xs font-medium text-text-dimmed"
475+ >
458476 ClickHouse connection URL < span className = "text-rose-400" > *</ span >
459477 </ label >
460478 < Input
479+ id = { `${ fieldId } -connectionUrl` }
461480 name = "connectionUrl"
462481 type = "password"
463482 placeholder = "https://user:password@host:8443"
0 commit comments