Skip to content

i15653: better handle opening combo boxes in browse mode with automatically focus focusable elements disabled#16016

Merged
seanbudd merged 4 commits into
betafrom
i15653
Jan 10, 2024
Merged

i15653: better handle opening combo boxes in browse mode with automatically focus focusable elements disabled#16016
seanbudd merged 4 commits into
betafrom
i15653

Conversation

@michaelDCurran

Copy link
Copy Markdown
Member

Link to issue number:

Fixes #15653

Summary of the issue:

Two bugs are seen if automatically focus focus elements in browse mode is disabled. Possibly introduced when that setting was introduced, and made worse when browse mode focus code was further refacted in #14611.

  • In iTunes, arrowing up and down inside a combo box incorrectly switches back to browse mode.
  • In Firefox / Chrome, closing a combo box does not automatically switch back to browse mode.

Description of user facing changes

Description of development approach

BrowseModeDocument's collapseOrExpandControl script: if automatic focus focusable elements is disabled, delay the rest of the script to give time for the control to actually get focus.

  • Webkit (iTunes) virtualBuffer: do not treat the list items of a combo box as being part of the virtualBuffer.

Testing strategy:

  • Followed steps in Action Items in iTunes not accessible #15653 and ensured that NVDA did not automatically switch to browse mode when arrowing up and down a combo box in iTunes.
  • In both Firefox and Chrome, arrowed to a standard combo box in browse mode, presed alt down arrow, arrowed up and down the combo box, and presse alt+upArrow, and confirmed that NvDA switched back to browse mode.

Known issues with pull request:

  • iTunes combo boxes do not fire focus or statechange events when opening or closing the combo box. So although NvDA now correctly focuses the combo box and manages focus mode and browse mode appropriately, nothing is spoken when opening or closing the combo box. this is a limitation of iTunes and is not new.

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

…lements is not set, then delay the execution of the rest of the script to give time for the focus to move to the control.
… treated as part of the browse mode document.
@michaelDCurran michaelDCurran requested a review from a team as a code owner January 9, 2024 05:40
@michaelDCurran michaelDCurran requested review from gerald-hartig and removed request for a team January 9, 2024 05:40
seanbudd
seanbudd previously approved these changes Jan 9, 2024
Comment on lines +57 to +61
parent = obj.parent
if parent and parent.role == controlTypes.Role.LIST:
parent = parent.parent
if parent and parent.role == controlTypes.Role.COMBOBOX:
return False

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts on this form? I think its easier to understand the structure of the controls like this.

Suggested change
parent = obj.parent
if parent and parent.role == controlTypes.Role.LIST:
parent = parent.parent
if parent and parent.role == controlTypes.Role.COMBOBOX:
return False
parent = obj.parent
grandParent = parent.parent
if (
parent
and parent.role == controlTypes.Role.LIST
and grandParent
and grandParent.role == controlTypes.Role.COMBOBOX
):
return False

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed it is easier to parse, but it would be more costly, as you would be needlessly fetching grandparent in the vast majority of cases. And NvDAObject instantiation is not cheap. No doubt we could improve this, but right now that is the case.

Comment thread user_docs/en/changes.t2t Outdated
Co-authored-by: Sean Budd <sean@nvaccess.org>
@seanbudd seanbudd merged commit c7b3ead into beta Jan 10, 2024
@seanbudd seanbudd deleted the i15653 branch January 10, 2024 00:06
Adriani90 pushed a commit to Adriani90/nvda that referenced this pull request Mar 13, 2024
…ically focus focusable elements disabled (nvaccess#16016)

Fixes nvaccess#15653

Summary of the issue:
Two bugs are seen if automatically focus focus elements in browse mode is disabled. Possibly introduced when that setting was introduced, and made worse when browse mode focus code was further refacted in nvaccess#14611.

In iTunes, arrowing up and down inside a combo box incorrectly switches back to browse mode.
In Firefox / Chrome, closing a combo box does not automatically switch back to browse mode.
Description of user facing changes
NVDA will again switch back to browse mode when closing combo boxes with escape or alt+upArrow in Firefox or Chrome. (Action Items in iTunes not accessible nvaccess#15653)
Arrowing up and down in combo boxes in iTunes will no longer inappropriately switch back to browse mode. (Action Items in iTunes not accessible nvaccess#15653)
Description of development approach
BrowseModeDocument's collapseOrExpandControl script: if automatic focus focusable elements is disabled, delay the rest of the script to give time for the control to actually get focus.

Webkit (iTunes) virtualBuffer: do not treat the list items of a combo box as being part of the virtualBuffer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants