Skip to content

Commit

Permalink
Add support for aria-brailleroledescription from ARIA 1.3. (#14748)
Browse files Browse the repository at this point in the history
partial fix for #11829

Summary of the issue:
ARIA 1.3 adds a aria-brailleroledescription attribute, which allows the web author to specify a string representation for an element's role, specific to Braille.
For example:

<button aria-roledescription="planet" aria-brailleroledescription="plnt">Saturn</button>
A button whos spoken role description will be "planet" but in Braille it will be shown as the abreviated "plnt".

Description of user facing changes
NVDA will honor the aria-brailleroledescription attribute if set by the web author, when presenting web content on a braille display.

Description of development approach
The internal work to support custom braille role text had already been added to NVDAObjects and controlFields to allow for Braille abbreviations for landmarks. this PR:

Implements roleTextBraille on the IA2Web NVDAObject, exposing the content of the brailleroledescription IAccessible2 attribute if available
In the Gecko ia2 virtualBuffer, normalizes the brailleroledescription IAccessible2 attribute to the roleTextBraille NvDA attribute on controlFields.
  • Loading branch information
michaelDCurran authored Mar 30, 2023
1 parent daaddab commit 51aacac
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions source/NVDAObjects/IAccessible/ia2Web.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,12 @@ def _get_roleText(self):
return roleText
return super().roleText

def _get_roleTextBraille(self) -> str:
roleTextBraille = self.IA2Attributes.get('brailleroledescription')
if roleTextBraille:
return roleTextBraille
return super().roleTextBraille

def _get_states(self):
states=super(Ia2Web,self).states
# Ensure that ARIA gridcells always get the focusable state, even if the Browser fails to provide it.
Expand Down
3 changes: 3 additions & 0 deletions source/virtualBuffers/gecko_ia2.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ def _normalizeControlField(self, attrs): # noqa: C901
roleText=attrs.get("IAccessible2::attribute_roledescription")
if roleText:
attrs['roleText']=roleText
roleTextBraille = attrs.get("IAccessible2::attribute_brailleroledescription")
if roleTextBraille:
attrs['roleTextBraille'] = roleTextBraille
if attrs.get("IAccessible2::attribute_dropeffect", "none") != "none":
states.add(controlTypes.State.DROPTARGET)
if role==controlTypes.Role.LINK and controlTypes.State.LINKED not in states:
Expand Down
1 change: 1 addition & 0 deletions user_docs/en/changes.t2t
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ What's New in NVDA
-
- In Mozilla Firefox and Google Chrome, NVDA now reports when a control opens a dialog, grid, list or tree if the author has specified this using aria-haspopup. (#14709)
- It is now possible to use system variables (such as ``%temp%`` or ``%homepath%``) in the path specification while creating portable copies of NVDA. (#14680)
- Added support for the ``aria-brailleroledescription`` ARIA 1.3 attribute, allowing web authors to override the type of an element shown on the Braille display. (#14748)
-


Expand Down

0 comments on commit 51aacac

Please sign in to comment.