@@ -79,6 +79,7 @@ const CodeEditor = forwardRef((props: CodeEditorProps, ref: React.Ref<CodeEditor
7979 const mergedRef = useMergeRefs ( codeEditorMeasureRef , __internalRootRef ) ;
8080
8181 const paneId = useUniqueId ( 'code-editor-pane' ) ;
82+ const descriptionId = useUniqueId ( 'code-editor-description' ) ;
8283
8384 const [ paneStatus , setPaneStatus ] = useState < PaneStatus > ( 'hidden' ) ;
8485 const [ annotations , setAnnotations ] = useState < Ace . Annotation [ ] > ( [ ] ) ;
@@ -135,6 +136,13 @@ const CodeEditor = forwardRef((props: CodeEditorProps, ref: React.Ref<CodeEditor
135136 const warningCount = annotations . filter ( a => a . type === 'warning' ) . length ;
136137 const currentAnnotations = useMemo ( ( ) => annotations . filter ( a => a . type === paneStatus ) , [ annotations , paneStatus ] ) ;
137138
139+ const computedAriaDescription = useMemo ( ( ) => {
140+ const errorText = `${ errorCount } ${ i18n ( 'i18nStrings.errorsTab' , i18nStrings ?. errorsTab ) } ` ;
141+ const warningText = `${ warningCount } ${ i18n ( 'i18nStrings.warningsTab' , i18nStrings ?. warningsTab ) } ` ;
142+
143+ return `${ errorText } , ${ warningText } ` ;
144+ } , [ errorCount , warningCount , i18n , i18nStrings ] ) ;
145+
138146 /*
139147 * Callbacks
140148 */
@@ -224,13 +232,15 @@ const CodeEditor = forwardRef((props: CodeEditorProps, ref: React.Ref<CodeEditor
224232 handleAriaLabel = { i18n ( 'i18nStrings.resizeHandleAriaLabel' , i18nStrings ?. resizeHandleAriaLabel ) }
225233 handleTooltipText = { i18n ( 'i18nStrings.resizeHandleTooltipText' , i18nStrings ?. resizeHandleTooltipText ) }
226234 >
235+ < div id = { descriptionId } > { computedAriaDescription } </ div >
227236 < div
228237 ref = { editorRef }
229238 className = { clsx ( styles . editor , styles . ace , isRefresh && styles [ 'editor-refresh' ] ) }
230239 onKeyDown = { onEditorKeydown }
231240 tabIndex = { 0 }
232241 role = "group"
233242 aria-label = { i18n ( 'i18nStrings.editorGroupAriaLabel' , i18nStrings ?. editorGroupAriaLabel ) }
243+ aria-describedby = { descriptionId }
234244 />
235245 </ ResizableBox >
236246 < div
0 commit comments