@@ -1652,3 +1652,82 @@ def test_focusTargetReporting():
16521652 ]),
16531653 message = "focus mode - focus with Report Articles enabled"
16541654 )
1655+
1656+
1657+ def test_focus_mode_on_focusable_read_only_lists ():
1658+ """
1659+ If a list is read-only, but is focusable, and a list element receives focus, switch to focus mode.
1660+ """
1661+ _chrome .prepareChrome (
1662+ """
1663+ <a href="#">before Target</a>
1664+ <div role="list" aria-label="Messages" tabindex="-1">
1665+ <div role="listitem" tabindex="0" aria-label="Todd Kloots Hello all. At 1:30 PM">
1666+ <div role="document" aria-roledescription="message">
1667+ <a href="/kloots" class="sender">Todd Kloots</a> <a href="/time" class="time">1:30 PM</a>
1668+ <p>Hello all.</p>
1669+ </div>
1670+ </div>
1671+ </div>
1672+ """
1673+ )
1674+ # Set focus
1675+ actualSpeech = _chrome .getSpeechAfterKey ("tab" )
1676+ _asserts .strings_match (
1677+ actualSpeech ,
1678+ SPEECH_SEP .join ([
1679+ "before Target" ,
1680+ "link" ,
1681+ ])
1682+ )
1683+
1684+ # focus the list item
1685+ actualSpeech = _chrome .getSpeechAfterKey ("tab" )
1686+ _asserts .strings_match (
1687+ actualSpeech ,
1688+ SPEECH_CALL_SEP .join ([
1689+ SPEECH_SEP .join ([
1690+ "Messages" , # name for list container
1691+ "list" , # role for list container
1692+ ]),
1693+ SPEECH_SEP .join ([
1694+ "level 1" , # Inserted by Chromium even though not explicitly set
1695+ "Todd Kloots Hello all. At 1:30 PM" , # list element name, should read first
1696+ "1 of 1" , # item count, no role expected here
1697+ ]),
1698+ "Focus mode" , # Focus mode should be enabled automatically and be indicated
1699+ ]),
1700+ message = "focus mode - focus list item and turn on focus mode"
1701+ )
1702+
1703+ # Tab into the document, which should turn on browse mode
1704+ actualSpeech = _chrome .getSpeechAfterKey ("tab" )
1705+ _asserts .strings_match (
1706+ actualSpeech ,
1707+ SPEECH_CALL_SEP .join ([
1708+ SPEECH_SEP .join ([
1709+ "" , # empty name, document is unnamed
1710+ "message" , # role description for document container
1711+ ]),
1712+ SPEECH_SEP .join ([
1713+ "Todd Kloots" , # name for link
1714+ "link" , # role for link
1715+ ]),
1716+ "Browse mode" , # Focus mode should be disabled automatically and be indicated
1717+ ]),
1718+ message = "focus mode - focus link in document and turn off focus mode"
1719+ )
1720+
1721+ # shift+tab back to the focusable list item
1722+ actualSpeech = _chrome .getSpeechAfterKey ("shift+tab" )
1723+ _asserts .strings_match (
1724+ actualSpeech ,
1725+ SPEECH_CALL_SEP .join ([
1726+ SPEECH_SEP .join ([
1727+ "Todd Kloots Hello all. At 1:30 PM" , # list element name, should read first
1728+ "1 of 1" , # item count, no role expected here
1729+ ]),
1730+ "Focus mode" , # Focus mode should be enabled automatically and be indicated
1731+ ]),
1732+ message = "focus mode - focus list item and turn on focus mode"
1733+ )
0 commit comments