Skip to content

Commit bcc6ac8

Browse files
Merge d33c7c8 into 43525cd
2 parents 43525cd + d33c7c8 commit bcc6ac8

4 files changed

Lines changed: 67 additions & 2 deletions

File tree

source/NVDAObjects/__init__.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,18 @@ def event_selection(self):
12051205
self.event_stateChange()
12061206

12071207
def event_stateChange(self):
1208-
if self is api.getFocusObject():
1208+
# Automatically announce state changes for certain objects.
1209+
inFocus = (
1210+
# this is the current focus:
1211+
# E.g. announcing the checked state of a checkbox
1212+
self is api.getFocusObject()
1213+
# this is a focuse ancestor:
1214+
# Including the ancestors supports scenarios such as
1215+
# when pressing a focused button changes the state of an ancestor container,
1216+
# E.g. a button inside a column header that changes the sorting state of the column (#10890)
1217+
or any(self is obj for obj in api.getFocusAncestors())
1218+
)
1219+
if inFocus:
12091220
speech.speakObjectProperties(self, states=True, reason=controlTypes.OutputReason.CHANGE)
12101221
braille.handler.handleUpdate(self)
12111222
vision.handler.handleUpdate(self, property="states")

tests/system/robot/chromeTests.py

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@ def test_ariaCheckbox_browseMode():
872872
"""
873873
Navigate to an unchecked checkbox in reading mode.
874874
"""
875-
testFile = os.path.join(ARIAExamplesDir, "checkbox", "checkbox.html")
875+
testFile = os.path.join(ARIAExamplesDir, "checkbox", "checkbox-1", "checkbox-1.html")
876876
_chrome.prepareChrome(
877877
f"""
878878
<iframe src="{testFile}"></iframe>
@@ -2106,6 +2106,55 @@ def test_focus_mode_on_focusable_read_only_lists():
21062106
)
21072107

21082108

2109+
def test_i10890():
2110+
"""
2111+
Ensure that sort state is announced on a column header when changed with inner button
2112+
"""
2113+
spy = _NvdaLib.getSpyLib()
2114+
# Chrome sometimes exposes tables as clickable, sometimes not.
2115+
# This test does not need to know, so disable reporting of clickables.
2116+
spy.set_configValue(["documentFormatting", "reportClickable"], False)
2117+
testFile = os.path.join(ARIAExamplesDir, "grid", "datagrids.html")
2118+
_chrome.prepareChrome(
2119+
f"""
2120+
<iframe src="{testFile}"></iframe>
2121+
"""
2122+
)
2123+
# Jump to the Example 2 heading
2124+
_chrome.getSpeechAfterKey("3")
2125+
actualSpeech = _chrome.getSpeechAfterKey("3")
2126+
_asserts.strings_match(
2127+
actualSpeech,
2128+
SPEECH_SEP.join([
2129+
"Example 2: Sortable Data Grid With Editable Cells",
2130+
"heading",
2131+
"level 3",
2132+
])
2133+
)
2134+
# Jump to the table
2135+
actualSpeech = _chrome.getSpeechAfterKey("t")
2136+
_asserts.strings_match(
2137+
actualSpeech,
2138+
SPEECH_SEP.join([
2139+
"Transactions January 1 through January 7",
2140+
"table",
2141+
"with 8 rows and 6 columns",
2142+
"row 1",
2143+
"column 1",
2144+
"sorted ascending",
2145+
"Date",
2146+
"button",
2147+
])
2148+
)
2149+
# Press the button
2150+
actualSpeech = _chrome.getSpeechAfterKey("space")
2151+
# and ensure that the new sort state is spoken.
2152+
_asserts.strings_match(
2153+
actualSpeech,
2154+
"sorted descending",
2155+
)
2156+
2157+
21092158
def test_ARIASwitchRole():
21102159
"""
21112160
Ensure that ARIA switch controls have an appropriate role and states in browse mode.

tests/system/robot/chromeTests.robot

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ focus mode is turned on on focused read-only list item
138138
ARIA details role
139139
[Documentation] Test aria details roles being announced on discovery
140140
test_mark_aria_details_role
141+
<<<<<<< HEAD
142+
i10890
143+
[Documentation] Test sort state is announced on column header when changed with inner button
144+
test_i10890
141145
ARIA switch role
142146
[Documentation] Test aria switch control has appropriate role and states in browse mode and when focused
143147
test_ARIASwitchRole

user_docs/en/changes.t2t

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ What's New in NVDA
3131
- In Firefox, activating the "Show options" button on GitHub issue pages now works reliably. (#14269)
3232
- The date picker controls in Outlook 2016 / 365 Advanced search dialog now report their label and value. (#12726)
3333
- ARIA switch controls are now actually reported as switches in Firefox, Chrome and Edge, rather than checkboxes. (#11310)
34+
- NVDA will automatically announce the sort state on an HTML table column header when changed by pressing an inner button. (#10890)
3435
-
3536

3637

0 commit comments

Comments
 (0)