Skip to content

Windows 11 Notepad: take 2 on announcing status bar contents in newer app releases via UIA decendants#14622

Merged
seanbudd merged 11 commits into
nvaccess:masterfrom
josephsl:win11NotepadStatusBarUIADescendants
Mar 28, 2023
Merged

Windows 11 Notepad: take 2 on announcing status bar contents in newer app releases via UIA decendants#14622
seanbudd merged 11 commits into
nvaccess:masterfrom
josephsl:win11NotepadStatusBarUIADescendants

Conversation

@josephsl

@josephsl josephsl commented Feb 10, 2023

Copy link
Copy Markdown
Contributor

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):

  1. Open Notepad.
  2. Enable status bar (View/Status bar is checked).
  3. Type something.
  4. Press status bar command (NVDA+End in desktop layout, NVDA+Shift+End in laptop layout).
  5. In Notepad 11.2301 and later, press Control+N to open a new tab.
  6. Perform status bar announcement command.
  7. Press Alt+S to open Notepad settings window.
  8. Press Backspace to close settings window.
  9. Perform status bar announcement command again.

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:

  • 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
  • Security precautions taken.

…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.
@josephsl josephsl requested a review from a team as a code owner February 10, 2023 00:18
@AppVeyorBot

Copy link
Copy Markdown

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.
@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit a0b2fff61f

@seanbudd seanbudd merged commit e09e704 into nvaccess:master Mar 28, 2023
@nvaccessAuto nvaccessAuto added this to the 2023.2 milestone Mar 28, 2023
@seanbudd

Copy link
Copy Markdown
Member

Thanks for waiting @josephsl

@josephsl josephsl deleted the win11NotepadStatusBarUIADescendants branch March 31, 2023 15: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.

Windows 11 Notepad: status bar retrieval fails if Notepad UI is redesigned, specifically with tabbed Notepad

4 participants