Browse mode with auto focus focusable elements disabled: Fix activation of non-focusable objects and activation after using the tab key.#11130
Merged
michaelDCurran merged 1 commit intoMay 13, 2020
Conversation
…on of non-focusable objects and activation after using the tab key. Previously, with auto focus focusable elements disabled, browse mode tracked the last focusable object and used this when activating at the caret. This meant that it wasn't possible to activate objects that weren't focusable. Furthermore, this wasn't updated correctly when using the tab key, which meant it wasn't possible to activate at the caret after tabbing. To fix this: 1. Don't keep track of the last focusable object. Instead, _focusLastFocusableObject always uses the focusable ancestor of the caret. 2. If _focusLastFocusableObject is requested to activate, it does so using the object at the caret, not the focusable ancestor. This handles the case where the object at the caret isn't focusable. 3. _focusLastFocusableObject temporarily saves the object which is pending focus. This is because we might be about to activate or pass through a key which will cause this object to change (e.g. checing a check box). However, we won't actually get the focus event until after the change has occurred. The speech property cache on this saved object reflects the properties before the activation. 4. When the focus event arrives, event_gainFocus uses this saved pending focus object to report the change (if any) that occurred.
LeonarddeR
reviewed
May 8, 2020
LeonarddeR
left a comment
Collaborator
There was a problem hiding this comment.
Thanks a lot for taking this further!
| if reason == controlTypes.REASON_FOCUS: | ||
| self._lastCaretMoveWasFocus = True | ||
| focusObj = api.getFocusObject() | ||
| self._lastFocusableObj = None |
Collaborator
There was a problem hiding this comment.
Should self._objPendingFocusBeforeActivate also be set to None here?
Contributor
Author
There was a problem hiding this comment.
I'm not entirely sure why _lastFocusableObj was set to None there. I suspect that might have been what was breaking the tab key. Of course, that won't happen with the new implementation, but I also don't know that there's any need to clear it here either.
michaelDCurran
approved these changes
May 13, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link to issue number:
Fixes #8528. Fixes #9886.
Based on @LeonarddeR's try build in #9511 (comment), commit 72316d5, but with a fix for the over-chatting described in #9511 (comment).
Summary of the issue:
In browse mode, with auto focus focusable elements disabled, it is not possible to activate non-focusable elements or activate an object after tabbing. Also, activating would sometimes cause NVDA to click in the wrong place, causing weirdness such as focusing the address bar or task bar.
Description of how this pull request fixes the issue:
Previously, with auto focus focusable elements disabled, browse mode tracked the last focusable object and used this when activating at the caret. This meant that it wasn't possible to activate objects that weren't focusable. Furthermore, this wasn't updated correctly when using the tab key, which meant it wasn't possible to activate at the caret after tabbing.
To fix this:
Testing performed:
Test case:
data:text/html,<button>a</button><button onClick="alert('b');">b</button><div onClick="alert('c');">c</div><input type="checkbox" aria-label="d"><div contenteditable><p>e</p></div>Known issues with pull request:
None known.
Change log entry:
Bug fixes: