Skip to content

Commit 771e37b

Browse files
Merge b4f06c0 into c4de9f9
2 parents c4de9f9 + b4f06c0 commit 771e37b

6 files changed

Lines changed: 72 additions & 2 deletions

File tree

source/NVDAObjects/IAccessible/chromium.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,22 @@ def _get_states(self):
7474
return states
7575

7676

77+
class PresentationalList(ia2Web.Ia2Web):
78+
"""
79+
Ensures that lists like UL, DL and OL always have the readonly state.
80+
A work-around for issue #7562
81+
allowing us to differentiate presentational lists from interactive lists
82+
(such as of size greater 1 and ARIA list boxes).
83+
In firefox, this is possible by the presence of a read-only state,
84+
even in a content editable.
85+
"""
86+
87+
def _get_states(self):
88+
states = super().states
89+
states.add(controlTypes.STATE_READONLY)
90+
return states
91+
92+
7793
def findExtraOverlayClasses(obj, clsList):
7894
"""Determine the most appropriate class(es) for Chromium objects.
7995
This works similarly to L{NVDAObjects.NVDAObject.findOverlayClasses} except that it never calls any other findOverlayClasses method.
@@ -82,5 +98,7 @@ def findExtraOverlayClasses(obj, clsList):
8298
clsList.append(ComboboxListItem)
8399
elif obj.role == controlTypes.ROLE_TOGGLEBUTTON:
84100
clsList.append(ToggleButton)
101+
elif obj.role == controlTypes.ROLE_LIST and obj.IA2Attributes.get('tag') in ('ul', 'dl', 'ol'):
102+
clsList.append(PresentationalList)
85103
ia2Web.findExtraOverlayClasses(obj, clsList,
86104
documentClass=Document)

tests/system/libraries/ChromeLib.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ def _writeTestFile(testCase) -> str:
7171
<title>{ChromeLib._testCaseTitle}</title>
7272
</head>
7373
<body>
74-
<button>{ChromeLib._beforeMarker}</button>
74+
<p>{ChromeLib._beforeMarker}</p>
7575
{testCase}
76-
<button>{ChromeLib._afterMarker}</button>
76+
<p>{ChromeLib._afterMarker}</p>
7777
</body>
7878
""")
7979
with open(file=filePath, mode='w', encoding='UTF-8') as f:

tests/system/nvdaSettingsFiles/standard-doShowWelcomeDialog.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ schemaVersion = 2
1212
enableScratchpadDir = True
1313
[virtualBuffers]
1414
autoSayAllOnPageLoad = False
15+
passThroughAudioIndication = False

tests/system/nvdaSettingsFiles/standard-dontShowWelcomeDialog.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ schemaVersion = 2
1212
enableScratchpadDir = True
1313
[virtualBuffers]
1414
autoSayAllOnPageLoad = False
15+
passThroughAudioIndication = False

tests/system/robot/chromeTests.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# Imported for type information
1616
from ChromeLib import ChromeLib as _ChromeLib
1717
from AssertsLib import AssertsLib as _AssertsLib
18+
import NvdaLib as _nvdaLib
1819

1920
_builtIn: BuiltIn = BuiltIn()
2021
_chrome: _ChromeLib = _getLib("ChromeLib")
@@ -39,3 +40,49 @@ def checkbox_labelled_by_inner_element():
3940
# Instead this should be spoken as:
4041
"Simulate evil cat check box not checked"
4142
)
43+
44+
45+
def test_i7562():
46+
""" List should not be announced on every line of a ul in a contenteditable """
47+
spy = _nvdaLib.getSpyLib()
48+
_chrome.prepareChrome(
49+
r"""
50+
<div contenteditable="true">
51+
<p>before</p>
52+
<ul>
53+
<li>frogs</li>
54+
<li>birds</li>
55+
</ul>
56+
<p>after</p>
57+
</div>
58+
"""
59+
)
60+
actualSpeech = _chrome.getSpeechAfterKey("NVDA+space")
61+
_asserts.strings_match(
62+
actualSpeech,
63+
"Focus mode"
64+
)
65+
# Tab into the contenteditable
66+
actualSpeech = _chrome.getSpeechAfterKey("tab")
67+
_asserts.strings_match(
68+
actualSpeech,
69+
"section multi line editable before"
70+
)
71+
# DownArow into the list. 'list' should be announced when entering.
72+
actualSpeech = _chrome.getSpeechAfterKey("downArrow")
73+
_asserts.strings_match(
74+
actualSpeech,
75+
"list bullet frogs"
76+
)
77+
# DownArrow to the second list item. 'list' should not be announced.
78+
actualSpeech = _chrome.getSpeechAfterKey("downArrow")
79+
_asserts.strings_match(
80+
actualSpeech,
81+
"bullet birds"
82+
)
83+
# DownArrow out of the list. 'out of list' should be announced.
84+
actualSpeech = _chrome.getSpeechAfterKey("downArrow")
85+
_asserts.strings_match(
86+
actualSpeech,
87+
"out of list after",
88+
)

tests/system/robot/chromeTests.robot

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,6 @@ default teardown
2626
checkbox labelled by inner element
2727
[Documentation] A checkbox labelled by an inner element should not read the label element twice.
2828
checkbox_labelled_by_inner_element
29+
i7562
30+
[Documentation] List should not be announced on every line of a ul in a contenteditable
31+
test_i7562

0 commit comments

Comments
 (0)