File tree Expand file tree Collapse file tree 2 files changed +24
-15
lines changed Expand file tree Collapse file tree 2 files changed +24
-15
lines changed Original file line number Diff line number Diff line change @@ -82,7 +82,6 @@ export function ConnectedFormGroup<T extends ConnectedField>({
8282 infotip = { infotip }
8383 isSoloField = { isSoloField }
8484 required = { ! ! validation ?. required }
85- size = { labelSize }
8685 >
8786 { label }
8887 </ FormGroupLabel >
@@ -103,13 +102,19 @@ export function ConnectedFormGroup<T extends ConnectedField>({
103102 name = { name }
104103 />
105104 { children }
106- { showError && (
107- < FormError
108- aria-live = { isFirstError ? 'assertive' : 'off' }
109- id = { errorId }
110- role = { isFirstError ? 'alert' : 'status' }
111- variant = { errorType }
112- >
105+ { /*
106+ * For screen readers to read new content, role="alert" and/or
107+ * aria-live wrapper elements must be present *before* content is
108+ * added. Thus, we need to render the FormError span always,
109+ * regardless of whether or not there is an error.
110+ */ }
111+ < FormError
112+ aria-live = { isFirstError ? 'assertive' : 'off' }
113+ id = { errorId }
114+ role = { isFirstError ? 'alert' : 'status' }
115+ variant = { errorType }
116+ >
117+ { showError && (
113118 < Markdown
114119 inline
115120 overrides = { {
@@ -126,8 +131,8 @@ export function ConnectedFormGroup<T extends ConnectedField>({
126131 spacing = "none"
127132 text = { textError }
128133 />
129- </ FormError >
130- ) }
134+ ) }
135+ </ FormError >
131136 </ FormGroup >
132137 ) ;
133138}
Original file line number Diff line number Diff line change @@ -98,11 +98,15 @@ export const FormGroup: React.FC<FormGroupProps> = ({
9898 { labelComponent }
9999 { descriptionComponent }
100100 { children }
101- { error && (
102- < FormError aria-live = "polite" role = "alert" >
103- { error }
104- </ FormError >
105- ) }
101+ { /*
102+ * For screen readers to read new content, role="alert" and/or
103+ * aria-live wrapper elements must be present *before* content is
104+ * added. Thus, we need to render the FormError span always,
105+ * regardless of whether or not there is an error.
106+ */ }
107+ < FormError aria-live = "polite" role = "alert" >
108+ { error }
109+ </ FormError >
106110 </ FormGroupContainer >
107111 ) ;
108112} ;
You can’t perform that action at this time.
0 commit comments