Skip to content

Improve support for combo boxes in all browsers#8687

Merged
michaelDCurran merged 6 commits intomasterfrom
i8664
Sep 4, 2018
Merged

Improve support for combo boxes in all browsers#8687
michaelDCurran merged 6 commits intomasterfrom
i8664

Conversation

@michaelDCurran
Copy link
Copy Markdown
Member

@michaelDCurran michaelDCurran commented Aug 29, 2018

Link to issue number:

Fixes #8664

Summary of the issue:

Currently in NVDA, the user experience when using combo boxes on the web significantly differs by browser, plus some of the original code written to handle combo boxes has now broken in multiple browsers.
For example:
*In Firefox, collapsing a combo box works, but browseMode is not re-enabled.

  • In Chrome 68, focusing a collapsed combo box ends up focusing the active list item within the combo box, even though it is collapsed.
  • In Chrome 68 and 70, collapsing a combo box with escape/enter/alt+upArrow simply switches to browseMode and does not collapse the combo box.
  • In Edge, Expanding the combo box and then arrowing through the options reports nothing and an exception occurs.

Description of how this pull request fixes the issue:

This PR standardizes the way we handle combo boxes in browseMode, so that:

  • Anything inside a combo box is treated as not being in the browseMode document. This means that if the combo box is expanded and focus is inside, browseMode completely ignores it.
  • Alt+downArrow when in browseMode expands the combo box and switches to focus mode, but also remembers the combo box, so that the next focus event in browseMode (if it is for the combo box), switches back to browseMode again (as this means the combo box has been collapsed). Technically there is no need to toggle focus mode and browseMode at all, but this keeps UX compatible with previous NVDA versions.

This PR also partly works around a bug in Chrome 68 and below where focusing a collapsed combo box focuses the active list item within the combo box. This has been fixed in Chrome 70.

This PR also fixes an issue in Edge where list items in the combo box were being treated were being treated as part of the document but with a broken textRange.

Testing performed:

Tested a standard HTML select (size=1) in Firefox 52, Firefox Nightly, Chrome 68 and Chrome 70.
Arrowed to the combo box in browse mode. Pressed alt+downArrow. Arrowed through the list. And closed the combo box with either enter, escape or alt+upArrow.

Known issues with pull request:

Combo boxes in Chrome 68 and below are still not perfect, but no worse than what they were before this PR.

Change log entry:

Bug fixes:

  • Interacting with combo boxes on the web in Firefox, Chrome and Internet Explorer has been improved.

…ject is a descendant of the document by searching the ancestry for the document's runtimeID with a treeWalker.
@michaelDCurran michaelDCurran changed the title Improve support for combo boxes in Firefox / Chrome / Internet Explorer Improve support for combo boxes in all browsers Aug 29, 2018
try:
# Allow NVDAObjects to redirect focus events to another object of their choosing.
if eventName=="gainFocus" and obj.focusRedirect:
obj=obj.focusRedirect
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

focusRedirect is used in the powerpnt appModule. We might have to make sure that this does not break. Having said that, I really like this being handled on the events level!

…at has a focusRedirect property as this is now handled in eventHandler.
@michaelDCurran
Copy link
Copy Markdown
Member Author

michaelDCurran commented Aug 30, 2018 via email

Copy link
Copy Markdown
Collaborator

@LeonarddeR LeonarddeR left a comment

Choose a reason for hiding this comment

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

I found the following issue in Firefox:

  1. Explicitly disable browse mode with NVDA+space
  2. Expand and collapse a combo box

Expected: Browse mode stays off
Actual: Browse mode enables after collapsing the combo box.

Also, I wonder whether it would make sense to have the activate script expand a combo box (for example when pressing space on a combo box when in browse mode).

@michaelDCurran
Copy link
Copy Markdown
Member Author

@LeonarddeR: I fixed the issue you found with NVDA switching back to browseMode after collapsing a combo box in focus mode.
In regards to your query on whether we should automatically expand a combobox when pressing enter/space in browseMode: I don't think we should at this point in time as it is certainly valid to press enter/space on a combo box and then use the arrow keys to change the combo box value with out expanding it. This would no longer be possible, unless you explicitly switched to focus mode.

@LeonarddeR
Copy link
Copy Markdown
Collaborator

LeonarddeR commented Sep 3, 2018 via email

@michaelDCurran
Copy link
Copy Markdown
Member Author

michaelDCurran commented Sep 3, 2018 via email

@LeonarddeR
Copy link
Copy Markdown
Collaborator

Sorry it took me some time to get back to this.

I'm now observing the following in Firefox:

  1. In firefox, select a combo box in browse mode.
  2. Expand with alt+down arrow
  3. Press tab

Expected: NVDA stays in focus mode and moves to the control in tab order after the combo box. This is how Edge and IE work.
Actual: The combo box is collapsed and focus stays on the combo box. Browse mode is reactivated. IN Chrome 68, the focus stays on the combo box as well, but Chrome stays in focus mode. Another tab brings you to the expected next item in the tab order.

Apart from that, the code looks ok.

@michaelDCurran
Copy link
Copy Markdown
Member Author

michaelDCurran commented Sep 4, 2018 via email

LeonarddeR
LeonarddeR previously approved these changes Sep 4, 2018
Copy link
Copy Markdown
Collaborator

@LeonarddeR LeonarddeR left a comment

Choose a reason for hiding this comment

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

IN that case, I agree.

@michaelDCurran michaelDCurran merged commit 3f239de into master Sep 4, 2018
@nvaccessAuto nvaccessAuto added this to the 2018.4 milestone Sep 4, 2018
jcsteh added a commit to jcsteh/nvda that referenced this pull request Aug 7, 2019
1. If the first child of a combo box is a text box, render that text box in browse mode.
2. Previously, we treated anything inside a combo box as being outside a browse mode document (nvaccess#8687). Don't do this for text boxes. Otherwise, you can't switch back to browse mode when the text box has focus.
jcsteh added a commit to jcsteh/nvda that referenced this pull request Aug 7, 2019
1. If the first child of a combo box is a text box, render that text box in browse mode.
2. Previously, we treated anything inside a combo box as being outside a browse mode document (nvaccess#8687). Don't do this for text boxes. Otherwise, you can't switch back to browse mode when the text box has focus.
jcsteh added a commit to jcsteh/nvda that referenced this pull request Aug 7, 2019
1. If the first child of a combo box is a text box, render that text box in browse mode.
2. Previously, we treated anything inside a combo box as being outside a browse mode document (nvaccess#8687). Don't do this for text boxes. Otherwise, you can't switch back to browse mode when the text box has focus.
jcsteh added a commit to jcsteh/nvda that referenced this pull request Aug 7, 2019
1. If the first child of a combo box is a text box, render that text box in browse mode.
2. Previously, we treated anything inside a combo box as being outside a browse mode document (nvaccess#8687). Don't do this for text boxes. Otherwise, you can't switch back to browse mode when the text box has focus.
michaelDCurran pushed a commit that referenced this pull request Sep 13, 2019
1. If the first child of a combo box is a text box, render that text box in browse mode.
2. Previously, we treated anything inside a combo box as being outside a browse mode document (#8687). Don't do this for text boxes. Otherwise, you can't switch back to browse mode when the text box has focus.
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.

Unable to close combo boxes in Google Chrome

3 participants