Fix duplicate role name when aria-roledescription is present

When an element has aria-roledescription (e.g. Discord messages use
'Message'), _generateRoleName was adding both the roledescription AND
the standard localized role name (e.g. 'article'). This resulted in
the role being announced twice.

The aria-roledescription attribute is intended to replace the standard
role name, not supplement it. Return early after adding the
roledescription to match Orca's behavior.
This commit is contained in:
2026-02-17 19:21:36 +00:00
parent 07138197cb
commit 8312a842c1

View File

@@ -560,6 +560,9 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
if roledescription:
result = [roledescription]
result.extend(self.voice(speech_generator.SYSTEM, obj=obj, **args))
# aria-roledescription replaces the standard role name, so return
# early to avoid announcing both (e.g. "Message" + "article").
return result
role = args.get('role', AXObject.get_role(obj))
roleSoundPresentation = cthulhu.cthulhuApp.settingsManager.getSetting('roleSoundPresentation')