File tree Expand file tree Collapse file tree
common/phone-number-field Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ ---
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ export const PhoneNumberField = React.forwardRef(function PhoneNumberField(
4040 const { translateError } = useLocalizations ( ) ;
4141 const [ isOpen , setOpen ] = React . useState ( false ) ;
4242 const [ selectedCountry , setSelectedCountry ] = React . useState ( countryOptions [ 0 ] ) ;
43+ const id = React . useId ( ) ;
4344 const containerRef = React . useRef < HTMLDivElement > ( null ) ;
4445 const inputRef = React . useRef < HTMLInputElement > ( null ) ;
4546 const commandListRef = React . useRef < HTMLDivElement > ( null ) ;
@@ -95,7 +96,7 @@ export const PhoneNumberField = React.forwardRef(function PhoneNumberField(
9596 >
9697 < Field . Root >
9798 < Common . Label asChild >
98- < Field . Label >
99+ < Field . Label htmlFor = { id } >
99100 { label } { ' ' }
100101 { alternativeFieldTrigger ? (
101102 < Field . LabelEnd > { alternativeFieldTrigger } </ Field . LabelEnd >
@@ -200,6 +201,7 @@ export const PhoneNumberField = React.forwardRef(function PhoneNumberField(
200201 < input
201202 ref = { mergeRefs ( [ forwardedRef , inputRef ] ) }
202203 type = 'tel'
204+ id = { id }
203205 maxLength = { 25 }
204206 value = { formattedNumber }
205207 onPaste = { handlePaste }
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ export const Label = React.forwardRef(function Label(
3131 children,
3232 visuallyHidden,
3333 ...props
34- } : React . HTMLAttributes < HTMLLabelElement > & { visuallyHidden ?: boolean } ,
34+ } : React . HTMLAttributes < HTMLLabelElement > & { htmlFor ?: string ; visuallyHidden ?: boolean } ,
3535 forwardedRef : React . ForwardedRef < HTMLLabelElement > ,
3636) {
3737 return (
You can’t perform that action at this time.
0 commit comments