diff --git a/source/NVDAObjects/IAccessible/__init__.py b/source/NVDAObjects/IAccessible/__init__.py index 5e6e77d4ff7..b72dfc2b36e 100644 --- a/source/NVDAObjects/IAccessible/__init__.py +++ b/source/NVDAObjects/IAccessible/__init__.py @@ -2033,12 +2033,16 @@ def event_alert(self) -> None: api.processPendingEvents() if self in api.getFocusAncestors(): return - speech.speakObject(self, reason=controlTypes.OutputReason.FOCUS, priority=speech.Spri.NOW) + speech.speakObjectProperties(self, role=True, name=True, reason=controlTypes.OutputReason.FOCUS, priority=speech.Spri.NOW) braille.handler.message(braille.getPropertiesBraille(name=self.name, role=self.role)) for child in self.recursiveDescendants: - if controlTypes.State.FOCUSABLE in child.states: - speech.speakObject(child, reason=controlTypes.OutputReason.FOCUS, priority=speech.Spri.NOW) - braille.handler.message(braille.getPropertiesBraille(name=self.name, role=self.role)) + if not child.name or child.name.isspace(): + continue + # Skip text leaves whose parent already has the same name, to avoid double announcement. + if child.parent and child.parent is not self and child.parent.name == child.name: + continue + speech.speakObject(child, reason=controlTypes.OutputReason.FOCUS, priority=speech.Spri.NOW) + braille.handler.message(braille.getPropertiesBraille(name=child.name, role=child.role)) def event_caret(self): focus = api.getFocusObject() diff --git a/user_docs/en/changes.md b/user_docs/en/changes.md index 9c8c13fd30d..856f7afb521 100644 --- a/user_docs/en/changes.md +++ b/user_docs/en/changes.md @@ -131,6 +131,7 @@ It currently includes Screen Curtain's settings (previously in the "Vision" cate * In the Input Gestures dialog, gestures including an operator while Num Lock is on will now be correctly displayed. (#19214, @CyrilleB79) * In Chromium browsers, if a document contains links with a malformed URL, reading the document will be possible again. (#19125, @nvdaes) * NVDA no longer plays a sound for spelling errors while typing if speech mode is set to on-demand or off. (#19323, @CyrilleB79) +* NVDA now announces all content inside `role="alert"` elements. (#14990, @mehm8128) ### Changes for Developers