Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report aria-haspopup dialog/grid/list/tree in Firefox and Chrome. #14709

Merged
merged 2 commits into from
Mar 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions source/NVDAObjects/IAccessible/ia2Web.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,13 @@ def _get_states(self):
# Google has a custom ARIA attribute to force a node's editable state off (such as in Google Slides).
if self.IA2Attributes.get('goog-editable')=="false":
states.discard(controlTypes.State.EDITABLE)
if controlTypes.State.HASPOPUP in states:
popupState = aria.ariaHaspopupValuesToNVDAStates.get(
self.IA2Attributes.get("haspopup")
)
if popupState:
states.discard(controlTypes.State.HASPOPUP)
states.add(popupState)
return states

def _get_landmark(self):
Expand Down
10 changes: 10 additions & 0 deletions source/aria.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,13 @@ class AriaLivePoliteness(str, Enum):
OFF = "off"
POLITE = "polite"
ASSERTIVE = "assertive"


ariaHaspopupValuesToNVDAStates: Dict[str, controlTypes.State] = {
"true": controlTypes.State.HASPOPUP,
"menu": controlTypes.State.HASPOPUP,
"dialog": controlTypes.State.HASPOPUP_DIALOG,
"grid": controlTypes.State.HASPOPUP_GRID,
"listbox": controlTypes.State.HASPOPUP_LIST,
"tree": controlTypes.State.HASPOPUP_TREE,
}
12 changes: 12 additions & 0 deletions source/controlTypes/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ def negativeDisplayString(self) -> str:
INDETERMINATE = setBit(44)
HALF_PRESSED = setBit(45)
ON = setBit(46)
HASPOPUP_DIALOG = setBit(47)
HASPOPUP_GRID = setBit(48)
HASPOPUP_LIST = setBit(49)
HASPOPUP_TREE = setBit(50)


STATES_SORTED = frozenset([State.SORTED, State.SORTED_ASCENDING, State.SORTED_DESCENDING])
Expand Down Expand Up @@ -192,6 +196,14 @@ def negativeDisplayString(self) -> str:
# Translators: a state that denotes a control is currently on
# E.g. a switch control.
State.ON: _("on"),
# Translators: Presented when a control has a pop-up dialog.
State.HASPOPUP_DIALOG: _("opens dialog"),
# Translators: Presented when a control has a pop-up grid.
State.HASPOPUP_GRID: _("opens grid"),
# Translators: Presented when a control has a pop-up list box.
State.HASPOPUP_LIST: _("opens list"),
# Translators: Presented when a control has a pop-up tree.
State.HASPOPUP_TREE: _("opens tree"),
}


Expand Down
6 changes: 6 additions & 0 deletions source/virtualBuffers/gecko_ia2.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ def _normalizeControlField(self, attrs): # noqa: C901
if controlTypes.State.CHECKED in states:
states.discard(controlTypes.State.CHECKED)
states.add(controlTypes.State.ON)
popupState = aria.ariaHaspopupValuesToNVDAStates.get(
attrs.get("IAccessible2::attribute_haspopup")
)
if popupState:
states.discard(controlTypes.State.HASPOPUP)
states.add(popupState)
attrs['role']=role
attrs['states']=states
if level != "" and level is not None:
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 @@ -7,6 +7,7 @@ What's New in NVDA

== New Features ==
- Added pronunciation of Unicode braille symbols such as "⠐⠣⠃⠗⠇⠐⠜". (#14548)
- 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)
-


Expand Down