File tree Expand file tree Collapse file tree
source/NVDAObjects/IAccessible Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -74,6 +74,15 @@ def _get_states(self):
7474 return states
7575
7676
77+ class PresentationalList (ia2Web .Ia2Web ):
78+ """ Ensures that lists like UL, DL and OL always have the readonly state."""
79+
80+ def _get_states (self ):
81+ states = super ().states
82+ states .add (controlTypes .STATE_READONLY )
83+ return states
84+
85+
7786def findExtraOverlayClasses (obj , clsList ):
7887 """Determine the most appropriate class(es) for Chromium objects.
7988 This works similarly to L{NVDAObjects.NVDAObject.findOverlayClasses} except that it never calls any other findOverlayClasses method.
@@ -82,5 +91,7 @@ def findExtraOverlayClasses(obj, clsList):
8291 clsList .append (ComboboxListItem )
8392 elif obj .role == controlTypes .ROLE_TOGGLEBUTTON :
8493 clsList .append (ToggleButton )
94+ elif obj .role == controlTypes .ROLE_LIST and obj .IA2Attributes .get ('tag' ) in ('ul' , 'dl' , 'ol' ):
95+ clsList .append (PresentationalList )
8596 ia2Web .findExtraOverlayClasses (obj , clsList ,
8697 documentClass = Document )
Original file line number Diff line number Diff line change 1515# Imported for type information
1616from ChromeLib import ChromeLib as _ChromeLib
1717from AssertsLib import AssertsLib as _AssertsLib
18+ import NvdaLib as _nvdaLib
1819
1920_builtIn : BuiltIn = BuiltIn ()
2021_chrome : _ChromeLib = _getLib ("ChromeLib" )
@@ -39,3 +40,39 @@ def checkbox_labelled_by_inner_element():
3940 # Instead this should be spoken as:
4041 "Simulate evil cat check box not checked"
4142 )
43+
44+ def test_i7562 ():
45+ """ List should not be announced on every line of a ul in a contenteditable """
46+ spy = _nvdaLib .getSpyLib ()
47+ _chrome .prepareChrome (
48+ r"""
49+ <div contenteditable="true">
50+ <p>before</p>
51+ <ul>
52+ <li>frogs</li>
53+ <li>birds</li>
54+ </ul>
55+ <p>after</p>
56+ </div>
57+ """
58+ )
59+ # Tab into the contenteditable - focus mode will be enabled.
60+ spy .emulateKeyPress ("tab" )
61+ # DownArow into the list. 'list' should be announced when entering.
62+ actualSpeech = _chrome .getSpeechAfterKey ("downArrow" )
63+ _asserts .strings_match (
64+ actualSpeech ,
65+ "list bullet frogs"
66+ )
67+ # DownArrow to the second list item. 'list' should not be announced.
68+ actualSpeech = _chrome .getSpeechAfterKey ("downArrow" )
69+ _asserts .strings_match (
70+ actualSpeech ,
71+ "bullet birds"
72+ )
73+ # DownArrow out of the list. 'out of list' should be announced.
74+ actualSpeech = _chrome .getSpeechAfterKey ("downArrow" )
75+ _asserts .strings_match (
76+ actualSpeech ,
77+ "out of list after" ,
78+ )
Original file line number Diff line number Diff line change @@ -26,3 +26,6 @@ default teardown
2626checkbox 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
You can’t perform that action at this time.
0 commit comments