Still report the new focus in browse mode if fetching the states from the old focus causes an exception when checking for defunct #12528
Merged
Merged
Conversation
…ates when checking if an object is defunct (dead), treat the object as defunct anyway. This ensures that the new focus will still be reported.
seanbudd
approved these changes
Jun 8, 2021
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 #12527
Summary of the issue:
In UI Automation browse mode implementations, sometimes the new focus is not announced if the old focus is removed from the DOM as the focus changes. This is true even in focus mode.
PR #12252 introduced a check for STATE_DEFUNCT on the old focus's states property. Although this works fine in Firefox / Chrome (they leave dead objects around with a defunct state), some UI Automation elements become completely unusable, and therefore an exception is raised when trying to fetch the states property.
As reported in issue #12527 The newly focused tweet in the Twitter app is no longer announced when pressing j / keys. And If using Edge/Chromium with UIA, some focus changes in Microsoft Word 365 Online are not announced.
Description of how this pull request fixes the issue:
In BrowseMode document's event_gainFocus method, Catch all exceptions when fetching states to check for defunct, and if an exception is raised, log the error and treat the object as being defunct.
Testing strategy:
Performed the testcase in the Twitter app, reported in issue #12527. Confirmed that the new focus is again reported, even though an exception is logged at debugWarning.
Known issues with pull request:
None known.
Change log entries:
New features
Changes
Bug fixes
For Developers
Code Review Checklist: