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 @@ -85,10 +85,11 @@ def normalizeIA2TextFormatField(formatField):
8585 except KeyError :
8686 invalid = None
8787 if invalid :
88- invalid = invalid .lower ()
89- if invalid == "spelling" :
88+ # aria-invalid can contain multiple values separated by a comma.
89+ invalidList = [x .lower ().strip () for x in invalid .split (',' )]
90+ if "spelling" in invalidList :
9091 formatField ["invalid-spelling" ]= True
91- elif invalid == "grammar" :
92+ if "grammar" in invalidList :
9293 formatField ["invalid-grammar" ]= True
9394 color = formatField .get ('color' )
9495 if color :
Original file line number Diff line number Diff line change @@ -288,3 +288,30 @@ def test_ariaTreeGrid_browseMode():
288288 "level 1 Treegrids are awesome Want to learn how to use them? aaron at thegoogle dot rocks expanded" ,
289289 ])
290290 )
291+
292+ def ARIAInvalid_spellingAndGrammar ():
293+ """
294+ Tests ARIA invalid values of "spelling", "grammar" and "spelling, grammar".
295+ """
296+ _chrome .prepareChrome (
297+ r"""
298+ <p>Big <span aria-invalid="spelling">caat</span> meos</p>
299+ <p>Small <span aria-invalid="grammar">a dog</span> woofs</p>
300+ <p>Fat <span aria-invalid="grammar, spelling">a ffrog</span> crokes</p>
301+ """
302+ )
303+ actualSpeech = _chrome .getSpeechAfterKey ("downArrow" )
304+ _asserts .strings_match (
305+ actualSpeech ,
306+ "Big spelling error caat meos"
307+ )
308+ actualSpeech = _chrome .getSpeechAfterKey ("downArrow" )
309+ _asserts .strings_match (
310+ actualSpeech ,
311+ "Small grammar error a dog woofs"
312+ )
313+ actualSpeech = _chrome .getSpeechAfterKey ("downArrow" )
314+ _asserts .strings_match (
315+ actualSpeech ,
316+ "Fat spelling error grammar error a ffrog crokes"
317+ )
Original file line number Diff line number Diff line change @@ -39,3 +39,6 @@ ARIA treegrid
3939 [Documentation] Ensure that ARIA treegrids are accessible as a standard table in browse mode.
4040 # Excluded due to regular failures.
4141 test_ariaTreeGrid_browseMode
42+ ARIA invalid spelling and grammar
43+ [Documentation] Tests ARIA invalid values of "spelling", "grammar" and "spelling, grammar".
44+ ARIAInvalid_spellingAndGrammar
You can’t perform that action at this time.
0 commit comments