-
-
Notifications
You must be signed in to change notification settings - Fork 641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NVDAObjects/UIA: add UIAAutomationId getter #11447
Merged
michaelDCurran
merged 4 commits into
nvaccess:master
from
josephsl:i11445UIAutomationIdProperty
Aug 3, 2020
Merged
NVDAObjects/UIA: add UIAAutomationId getter #11447
michaelDCurran
merged 4 commits into
nvaccess:master
from
josephsl:i11445UIAutomationIdProperty
Aug 3, 2020
Conversation
This file contains 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
. Sometimes a COM error is raised when trying to obtain cached automation Id, particularly if a UIA element isn't ready yet (for example, in modern keyboard). To avoid COM error, introduce a dedicated UIA Automation Id getter that either returns the Automation Id if found or an empty string. The overall structure is based on UIAFullDescription and UIAHelpText getters.
…old current Id information. Re nvaccess#11445. When going through overlay classes, instead of fetching cached Automation Id from the underlying UIA element, use the current Automation Id as returned by what U*IA actually says (based on new Automation Id getter). This reduces attribute access and removes the need for a try/except block for some cases as either the actual Automation Id or an empty string will be recorded. However, for backward compatibility, some notable try/except blocks such as search field checks will remain.
…en asking for dev info. Re nvaccess#11445.
I do this when exploring new UIA interfaces. |
Collaborator
Author
Hi, yep, for most cases, this can be ignored. A complication is that it may produce oddities with selective UIA event registration active. Thanks.
|
michaelDCurran
approved these changes
Aug 3, 2020
feerrenrut
pushed a commit
that referenced
this pull request
Feb 16, 2022
…13125) Closes #11483 Summary: As part of #11445 discussion, a UIAAutomationId getter was introduced (PR #11447) to UIA NVDA object class in NVDA 2020.3. Subsequent UIA work uses UIAAutomationId property but it wasn't expanded to cover all NVDA source code. Description of change: Converts obj.UIAElement.cachedAutomationId call to use obj.UIAAutomationId. obj.UIAAutomationId fetches current Automation Id string. All usages of cachedAutomationId are converted except for: - Excel app module: in one instance, UIA element is fetched and cached Automation Id is obtained directly from the element. - In NVDAObjects.UIA.UIA, there is one instance where parent UIA element is fetched and cached Automation Id is retrieved from the element directly.
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 #11445
Summary of the issue:
Due to timing errors (perhaps NVDA tries to fetch UIA element information before theelement is truly ready), COM error is raised, particularly more so when trying to obtain Automation Id when modern keyboard opens.
Description of how this pull request fixes the issue:
Adds UIAAutomationId getter to UIA NVDA object class. This will query the current Automation Id property for an element, returning the current value or an empty if no issues occur or an exception occurs, respectively. Along iwth this, edited find overlay classes method to use a local record of Automation Id to reduce attribute access.
Testing performed:
Tested:
Known issues with pull request:
If an element is destroyed, Automation Id property returns an empty string (observed after opening NVDA Python Console while focused on Start search box). This is a non-issue unless a developer is really interested in looking at Automation Id and somehow work with it while playing around in Python Console (a better way would be looking at developer info for navigator object). Also, for modern keyboard, this will allow NVDA to observe state change and UIA item selected events in more cases, especially if an emoji is selected when opening emoji panel a second time (modern keyboard issues will be dealt separately, which will involve rewriting event handlers).
Change log entry:
None needed.