File tree Expand file tree Collapse file tree
src/frontend/apps/impress/src/features/docs/doc-editor/components/AI Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -195,6 +195,25 @@ export const AIMenu = (props: AIMenuProps) => {
195195 return t ( 'Ask anything...' ) ;
196196 } , [ aiResponseStatus , t ] ) ;
197197
198+ const ariaLiveMessage = useMemo ( ( ) => {
199+ if ( aiResponseStatus === 'thinking' ) {
200+ return t ( 'AI is thinking' ) ;
201+ }
202+ if ( aiResponseStatus === 'ai-writing' ) {
203+ return t ( 'AI is writing' ) ;
204+ }
205+ if ( aiResponseStatus === 'user-reviewing' ) {
206+ return t ( 'AI response ready for review' ) ;
207+ }
208+ if ( aiResponseStatus === 'error' ) {
209+ return t ( 'AI request failed' ) ;
210+ }
211+
212+ return '' ;
213+ } , [ aiResponseStatus , t ] ) ;
214+
215+ const ariaLiveMode = aiResponseStatus === 'error' ? 'assertive' : 'polite' ;
216+
198217 const IconInput = useMemo ( ( ) => {
199218 if ( aiResponseStatus === 'thinking' ) {
200219 return < IconAI width = "24px" isLoading /> ;
@@ -256,6 +275,9 @@ export const AIMenu = (props: AIMenuProps) => {
256275 return (
257276 < Box className = "--docs--ai-menu" $width = "100%" >
258277 < AIMenuStyle />
278+ < span className = "sr-only" aria-live = { ariaLiveMode } aria-atomic = "true" >
279+ { ariaLiveMessage }
280+ </ span >
259281 < PromptSuggestionMenu
260282 onManualPromptSubmit = {
261283 props . onManualPromptSubmit || onManualPromptSubmitDefault
You can’t perform that action at this time.
0 commit comments