File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -167,7 +167,9 @@ export const Input = createFC<InputProps, { isFormElement: boolean }>(
167167
168168 const labelId = `${ prefix } -label-id` ;
169169
170- const labelFor = id ?? `${ prefix } -label-for` ;
170+ const rawTextId = id ?? `${ prefix } -raw-text-id` ;
171+ const inputId = id ?? `${ prefix } -input-id` ;
172+ const labelForId = readOnly ? rawTextId : inputId ;
171173
172174 const preAddonId = addonLeft ? `${ prefix } -pre-addon-id` : undefined ;
173175
@@ -186,7 +188,7 @@ export const Input = createFC<InputProps, { isFormElement: boolean }>(
186188 ) ;
187189 const inputElem = readOnly ? (
188190 < Text
189- id = { labelFor }
191+ id = { rawTextId }
190192 type = 'regular'
191193 category = 'body'
192194 aria-labelledby = { labelledBy }
@@ -197,7 +199,7 @@ export const Input = createFC<InputProps, { isFormElement: boolean }>(
197199 < input
198200 ref = { inputRef }
199201 className = { inputClassNames }
200- id = { labelFor }
202+ id = { inputId }
201203 type = { type }
202204 value = { value }
203205 defaultValue = { defaultValue }
@@ -238,7 +240,7 @@ export const Input = createFC<InputProps, { isFormElement: boolean }>(
238240 if ( isFieldSetColumn || label || required || error || cols ) {
239241 const formElemProps = {
240242 id : labelId ,
241- controlId : labelFor ,
243+ controlId : labelForId ,
242244 label,
243245 required,
244246 error,
You can’t perform that action at this time.
0 commit comments