Windows 11 Notepad: reposition status bar index to be the second to last item#14574
Merged
michaelDCurran merged 5 commits intoFeb 9, 2023
Merged
Conversation
…cess#14573. Upcoming Notepad version 11.2212 introduces tabbed interface, useful for opening multiple files in a single Notepad window. As a result, this changes the UI tree in that status bar entry position is no longer the eighth position. Thankfully, the status bar text is the second to last item in the Notepad UI tree across versions (stable and dev), so use -2 to represent status bar index.
6 tasks
michaelDCurran
approved these changes
Feb 9, 2023
Contributor
Author
|
Mick, hold on – I found a critical flaw with this PR: it fails if Notepad Settings window was open and closed, and found a solution for it. Thanks
|
Member
Contributor
Author
|
Hi, sorry for that – Microsoft released Notepad 11.2301 to Insider beta channel; at least the flaw was found before it went out to more people. The fix involves rethinking the status bar approach, borrowing heavily from File Explorer’s status bar method. Thanks.
|
josephsl
added a commit
to josephsl/nvda
that referenced
this pull request
Feb 9, 2023
…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.
6 tasks
seanbudd
added a commit
that referenced
this pull request
Mar 28, 2023
… app releases via UIA decendants (#14622) 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. --- commits: * appModules/notepad: use UIA descendants instead of child index when fetching status bar. Re #14573. #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 #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. * appModules/notepad: restore copyright header and type hints. Re #14573 * appModules/notepad: uiItemWindow -> notepadWindow * appModules/notepad: status bar/UIA descendatns now resembles File Explorer app module more closely. Re #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. * appModules/notepad: catch value error if the status bar content UIA element 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. * appModules/notepad: remove status bar location check. Since status bar UIA element is not defined if invisible, there is no need to check its location. * appModules/notepad: UIAHandler.handler.clientObject -> clientObject * update changes --------- Co-authored-by: Sean Budd <sean@nvaccess.org>
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 #14573
Summary of the issue:
Status bar contents are not read in Notepad 11.2212.
Description of user facing changes
Status bar will be read in newer Notepad 11 releases.
Description of development approach
Reposition status bar index to become second to last item (-2) in the Notepad UI tree. This is applicable in stable (11.2210 as of time of this pull request) and upcoming dev (11.2212) release with tabbed Notepad interface. Unless the UI tree changes significantly, this change will support old and new Windows 11 Notepad releases.
Testing strategy:
Manual testing:
Known issues with pull request:
None
Change log entries:
Bug fixes (can be grouped under Windows 11 fixes or as a standalone entry):
In newer releases of Windows 11 Notepad, NVDA can once again announce status bar contents. (#14573)
Code Review Checklist: