Windows 11 Notepad: take 2 on announcing status bar contents in newer app releases via UIA decendants#14622
Merged
seanbudd merged 11 commits intoMar 28, 2023
Conversation
…etching status bar. Re nvaccess#14573. nvaccess#14574 rework: Notepad 11.2301 introduces tabbed Notepad where multiple documents can be opened at once. This changes the Notepad UI tree so the old status bar chlid index no longer works. In the now reverted nvaccess#14574 pull request, a different status bar index was used, but it had a critical flaw: when Notepad settings (Alt+S) opens and then closes, status bar command will say something, caused by UI tree changing once again. A more robust solution is using UIA descendants to look for a specific element, and provided that the Automation Id for the first status bar text stays the same (ContentTextBlock), the descendants approach will work. This is the same approach used in File Explorer app module to obtain status bar contents in File Explorer.
See test results for failed build of commit 6ce4716378 |
…lorer app module more closely. Re nvaccess#14573. Inspired by status bar getter in File Explorer app module: because Notepad foreground window is not a UIA element, tell UIA handler to obtain UIA element from foreground window handle. Apart from this and checking for AutomationId, Notepad status bar getter resembles File Explorer app module.
…lement is NULL. UIA element for status bar contents wil be NULL (0x0) if status bar is not showing, therefore catch value error that can result from it.
Since status bar UIA element is not defined if invisible, there is no need to check its location.
See test results for failed build of commit a0b2fff61f |
6 tasks
seanbudd
approved these changes
Mar 28, 2023
Member
|
Thanks for waiting @josephsl |
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:
Closes #14573
Take 2 on #14573
Resolves a flaw discovered in #14574
Summary of the issue:
In #14574 and earlier, NVDA relied on child index when retrieving Windows 11 Notepad status bar contents. This is flawed: there are times when UI tree in Notepad can change if something opens and then closes. Specifically, when Notepad settings window (Alt+S) is opened and then closed, NVDA will announce something else when retrieving status bar contents.
Description of user facing changes
NVDA will announce status bar contents in newer Windows 11 Notepad releases (same as #14574).
Description of development approach
Use UIA's FindFirstBuildCache to retrieve status bar contents (Automation Id: ContentTextBlock). As long as the Automation Id stays the same, the descendants approach will work across Notepad 11 releases.
Testing strategy:
Manual testing (prerequisites: multiple Windows 11 computers, one being part of Windows Insidr Preview):
Expected: NVDA announces status bar contents such as character positoin and encoding.
Prior to #14574: NVDA will not nanounce status bar contents or say something else in Notepad 11.2301 and later.
With #14574: NVDA will sya something else when trying to announce the status bar after opening and closing Notepad settings.
With take 2: NVDA will announce status bar contents across Notepad 11 releases (with or without tabs and opening and closing settings window).
Known issues with pull request:
None
Change log entries:
Same as #14574
Code Review Checklist: