Skip to content

UIA objects and app modules: convert obj.UIAElement.cachedAutomationId to obj.UIAAutomationId#13125

Merged
feerrenrut merged 10 commits into
nvaccess:masterfrom
josephsl:i11483UIAAutomationId
Feb 16, 2022
Merged

UIA objects and app modules: convert obj.UIAElement.cachedAutomationId to obj.UIAAutomationId#13125
feerrenrut merged 10 commits into
nvaccess:masterfrom
josephsl:i11483UIAAutomationId

Conversation

@josephsl

@josephsl josephsl commented Dec 3, 2021

Copy link
Copy Markdown
Contributor

Link to issue number:

Closes #11483

Summary of the issue:

As part of #11445 discussion, a UIAAutomationId getter was introduced 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 how this pull request fixes the issue:

Converts obj.UIAElement.cachedAutomationId call to use obj.UIAAutomationId, which fetches (I believe) current Automation Id string. Most source code fragments that call cachedAutomationId were converted except for:

  • obj.devInfo: logs exceptions when trying to obtain current Automation Id.
  • UIA objects, specifically Word documents: there are places that fetches UIA elements directly, and for these, old syntax is retained.

In addition, general lint was done for modified files, along with recovering COM error handler for UIA search fields, suggestions lists, and parts of Explorer and Open With app modules since obj.UIAAutomationId will catch COM error itself and return an empty string.

Testing strategy:

Manual, system, and unit tests:

  • Manual testing: perform UIA-related tasks such as using Windows Terminal, Settings app in Windows 10, emoji panel, and other apps.
  • Unit and system tests were performed.

Known issues with pull request:

None

Change log entries:

Unnecessary unless a note on encouraging people to use UIAAutomationId property for UIA objects should be documented in changes for developers section.

Code Review Checklist:

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

Additional considerations:

PR #13107 comes with lint and changes for emoji panel app module, but it doesn't matter which PR gets tested, reviewed, and integrated first.

Thanks.

…-> obj.UIAAutomationId. Re nvaccess#11483.

Replace current AutomationID with obj.UIAAutomationId. The biggest benefit is that code surrounding obj.UIAAutomationId call does not have to check for COM error exception (the actual definition found in UIA NVDA objects does catch COM error exception) which simplifies the code. Also, perform general lint on surrouding code inside the function where obj.UIAAutomationId is called (most notably, adding whitespace around operators).
…1483.

Change obj.UIAElement.cachedAutomationID to obj.UIAAutomationId, along iwth linting emoji panel app module due to line length changes.
…nvaccess#11483.

Convert obj/self.UIAElement.cachedAutomationID to obj.UIAAutomationId, accompanied bh linting Word document edits.
…(dead code). Re nvaccess#11483.

Planned for a while: since obj.UIAAutomationId catches COM error, there is no need for UIA object's overlay class finder to handle this exception for search fields and suggestion lists. Therefore remove COM error handler for search fields.
@josephsl josephsl requested a review from a team as a code owner December 3, 2021 00:26
@josephsl josephsl requested a review from feerrenrut December 3, 2021 00:26
@josephsl

Copy link
Copy Markdown
Contributor Author

Perhaps postponing this to 2022.2 or 2023.1. Thanks.

@feerrenrut

Copy link
Copy Markdown
Contributor

@josephsl Sorry for the delay. Is there a technical reason to defer this? If so, please mark as a draft.

@feerrenrut feerrenrut left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The changes here are what is described, I don't see any issues. I'd like @michaelDCurran to confirm this approach is expected.

@josephsl

josephsl commented Feb 15, 2022 via email

Copy link
Copy Markdown
Contributor Author

@josephsl

josephsl commented Feb 15, 2022 via email

Copy link
Copy Markdown
Contributor Author

@michaelDCurran michaelDCurran left a comment

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.

This approach seems perfectly fine to me. @feerrenrut I am approving on this basis. Though I have not read through every specific change myself.

@feerrenrut

feerrenrut commented Feb 16, 2022

Copy link
Copy Markdown
Contributor

Thanks @michaelDCurran, I'll wait for @josephsl to confirm this is ready to merge. Todo:

  • confirm there are no more cachedAutomationId usages.
  • resolve conflicts.

@josephsl

Copy link
Copy Markdown
Contributor Author

Hi,

There are two instances of cachedAutomationId that should be kept:

  • 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.

Therefore, these will not be changed, and apart from that, things should be good to go (conflicts resolved and file headers updated).
Thanks.

@feerrenrut feerrenrut left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @josephsl

@feerrenrut

Copy link
Copy Markdown
Contributor

@josephsl could you double check the changes file entry for accuracy please?

@josephsl

josephsl commented Feb 16, 2022 via email

Copy link
Copy Markdown
Contributor Author

@feerrenrut feerrenrut merged commit 21a61e5 into nvaccess:master Feb 16, 2022
@nvaccessAuto nvaccessAuto added this to the 2022.1 milestone Feb 16, 2022
@josephsl josephsl deleted the i11483UIAAutomationId branch April 21, 2022 23:19
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.

UIA Automation Id/modern input facility: replace UIAElement.cachedAutomationId with UIAAutomationId

4 participants