File tree Expand file tree Collapse file tree 1 file changed +18
-17
lines changed
packages/form/src/text-field Expand file tree Collapse file tree 1 file changed +18
-17
lines changed Original file line number Diff line number Diff line change @@ -389,9 +389,24 @@ export function useTextField({
389
389
) ;
390
390
391
391
const errorIcon = useIcon ( "error" , propErrorIcon ) ;
392
- let messageProps : ProvidedFormMessageProps | undefined ;
392
+ const props : ProvidedTextFieldProps & {
393
+ messageProps ?: ProvidedFormMessageProps ;
394
+ } = {
395
+ id,
396
+ value,
397
+ theme,
398
+ error,
399
+ required,
400
+ pattern,
401
+ minLength,
402
+ maxLength : disableMaxLength ? undefined : maxLength ,
403
+ rightChildren : getErrorIcon ( errorMessage , error , errorIcon ) ,
404
+ onBlur : handleBlur ,
405
+ onChange : handleChange ,
406
+ } ;
393
407
if ( ! disableMessage ) {
394
- messageProps = {
408
+ props [ "aria-describedby" ] = messageId ;
409
+ props . messageProps = {
395
410
id : messageId ,
396
411
error,
397
412
theme,
@@ -403,21 +418,7 @@ export function useTextField({
403
418
404
419
return [
405
420
value ,
406
- {
407
- "aria-describedby" : disableMessage ? undefined : messageId ,
408
- id,
409
- value,
410
- theme,
411
- error,
412
- required,
413
- pattern,
414
- minLength,
415
- maxLength : disableMaxLength ? undefined : maxLength ,
416
- rightChildren : getErrorIcon ( errorMessage , error , errorIcon ) ,
417
- onBlur : handleBlur ,
418
- onChange : handleChange ,
419
- messageProps,
420
- } ,
421
+ props ,
421
422
{
422
423
reset,
423
424
setState,
You can’t perform that action at this time.
0 commit comments