Skip to content

Commit 2690e36

Browse files
Merge b426383 into 93fc1ed
2 parents 93fc1ed + b426383 commit 2690e36

4 files changed

Lines changed: 86 additions & 1 deletion

File tree

source/speech/speech.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2032,9 +2032,15 @@ def getControlFieldSpeech( # noqa: C901
20322032
nameSequence
20332033
and reason in [OutputReason.FOCUS, OutputReason.QUICKNAV]
20342034
and fieldType == "start_addedToControlFieldStack"
2035-
and role in (controlTypes.Role.GROUPING, controlTypes.Role.PROPERTYPAGE)
2035+
and role in (
2036+
controlTypes.Role.GROUPING,
2037+
controlTypes.Role.PROPERTYPAGE,
2038+
controlTypes.Role.LANDMARK,
2039+
controlTypes.Role.REGION,
2040+
)
20362041
):
20372042
# #10095, #3321, #709: Report the name and description of groupings (such as fieldsets) and tab pages
2043+
# #13307: report the label for landmarks and regions
20382044
nameAndRole = nameSequence[:]
20392045
nameAndRole.extend(roleTextSequence)
20402046
types.logBadSequenceTypes(nameAndRole)

tests/system/robot/chromeTests.py

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2275,3 +2275,78 @@ def test_ARIASwitchRole():
22752275
]),
22762276
message="Report focus",
22772277
)
2278+
2279+
2280+
def test_i13307():
2281+
"""
2282+
Even if (to avoid duplication) NVDA may choose to not speak a landmark or region's label
2283+
when arrowing into a landmark or region with an aria-labelledby,
2284+
it should still speak the label when junping inside the landmark or region
2285+
from outside using quicknav or focus.
2286+
"""
2287+
_chrome.prepareChrome(
2288+
"""
2289+
<p>navigation landmark with aria-label</p>
2290+
<nav aria-label="label">
2291+
<button>inner element</button>
2292+
</nav>
2293+
<p>Navigation landmark with aria-labelledby</p>
2294+
<nav aria-labelledby="innerHeading1">
2295+
<h1 id="innerHeading1">labelled by</h1>
2296+
<button>inner element</button>
2297+
</nav>
2298+
<p>Region with aria-label</p>
2299+
<section aria-label="label">
2300+
<button>inner element</button>
2301+
</section>
2302+
<p>Region with aria-labelledby</p>
2303+
<section aria-labelledby="innerHeading2">
2304+
<h1 id="innerHeading2">labelled by</h1>
2305+
<button>inner element</button>
2306+
</section>
2307+
"""
2308+
)
2309+
actualSpeech = _chrome.getSpeechAfterKey("tab")
2310+
_asserts.strings_match(
2311+
actualSpeech,
2312+
SPEECH_SEP.join([
2313+
"label",
2314+
"navigation landmark",
2315+
"inner element",
2316+
"button",
2317+
]),
2318+
message="jumping into landmark with aria-label should speak label",
2319+
)
2320+
actualSpeech = _chrome.getSpeechAfterKey("tab")
2321+
_asserts.strings_match(
2322+
actualSpeech,
2323+
SPEECH_SEP.join([
2324+
"labelled by",
2325+
"navigation landmark",
2326+
"inner element",
2327+
"button",
2328+
]),
2329+
message="jumping into landmark with aria-labelledby should speak label",
2330+
)
2331+
actualSpeech = _chrome.getSpeechAfterKey("tab")
2332+
_asserts.strings_match(
2333+
actualSpeech,
2334+
SPEECH_SEP.join([
2335+
"label",
2336+
"region",
2337+
"inner element",
2338+
"button",
2339+
]),
2340+
message="jumping into region with aria-label should speak label",
2341+
)
2342+
actualSpeech = _chrome.getSpeechAfterKey("tab")
2343+
_asserts.strings_match(
2344+
actualSpeech,
2345+
SPEECH_SEP.join([
2346+
"labelled by",
2347+
"region",
2348+
"inner element",
2349+
"button",
2350+
]),
2351+
message="jumping into region with aria-labelledby should speak label",
2352+
)

tests/system/robot/chromeTests.robot

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,6 @@ i10890
144144
ARIA switch role
145145
[Documentation] Test aria switch control has appropriate role and states in browse mode and when focused
146146
test_ARIASwitchRole
147+
i13307
148+
[Documentation] ensure aria-labelledby on a landmark or region is automatically spoken when jumping inside from outside using focus in browse mode
149+
test_i13307

user_docs/en/changes.t2t

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ What's New in NVDA
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)
3434
- NVDA will automatically announce the sort state on an HTML table column header when changed by pressing an inner button. (#10890)
35+
- A landmark or region's name is always automatically spoken when jumping inside from outside using quick navigation or focus in browse mode. (#13307)
3536
-
3637

3738

0 commit comments

Comments
 (0)