File tree Expand file tree Collapse file tree
packages/form/src/text-field Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -389,9 +389,24 @@ export function useTextField({
389389 ) ;
390390
391391 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+ } ;
393407 if ( ! disableMessage ) {
394- messageProps = {
408+ props [ "aria-describedby" ] = messageId ;
409+ props . messageProps = {
395410 id : messageId ,
396411 error,
397412 theme,
@@ -403,21 +418,7 @@ export function useTextField({
403418
404419 return [
405420 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 ,
421422 {
422423 reset,
423424 setState,
You can’t perform that action at this time.
0 commit comments