File tree Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -148,6 +148,15 @@ export const Fieldset = memo(
148
148
return renderOption ( { option : options [ 0 ] , i : undefined } ) ;
149
149
}
150
150
151
+ const messageId = ( ( ) => {
152
+ switch ( state ) {
153
+ case "error" :
154
+ return errorDescId ;
155
+ case "success" :
156
+ return successDescId ;
157
+ }
158
+ } ) ( ) ;
159
+
151
160
return (
152
161
< fieldset
153
162
id = { id }
@@ -184,6 +193,7 @@ export const Fieldset = memo(
184
193
fr . cx ( "fr-fieldset__legend" , "fr-text--regular" ) ,
185
194
classes . legend
186
195
) }
196
+ aria-describedby = { messageId }
187
197
>
188
198
{ legend }
189
199
{ hintText !== undefined && (
@@ -197,18 +207,11 @@ export const Fieldset = memo(
197
207
< div
198
208
className = { fr . cx ( "fr-messages-group" ) }
199
209
id = { messagesWrapperId }
200
- aria-live = " assertive"
210
+ aria-live = { state === "error" ? " assertive" : undefined }
201
211
>
202
212
{ stateRelatedMessage !== undefined && (
203
213
< p
204
- id = { ( ( ) => {
205
- switch ( state ) {
206
- case "error" :
207
- return errorDescId ;
208
- case "success" :
209
- return successDescId ;
210
- }
211
- } ) ( ) }
214
+ id = { messageId }
212
215
className = { fr . cx (
213
216
"fr-message" ,
214
217
( ( ) => {
You can’t perform that action at this time.
0 commit comments