nvda
5e4c8dc7 - Announce the current name of a UIA element that gains focus while its name changes (#21130)

Commit
9 days ago
Announce the current name of a UIA element that gains focus while its name changes (#21130) Fixes #21116 ### Summary of the issue: When a UI Automation element gains focus, NVDA reports its name from the values UI Automation cached when the application raised the focus event. Some applications raise the focus event just before they change the element's name. NVDA then announces the old name. ### Description of user facing changes: NVDA announces the current name of an item that gains focus while its name changes. Examples are a message in Unigram after jumping through a long chat, and a file in File Explorer after renaming it. ### Description of developer facing changes: None. ### Description of development approach: NVDA registers its UI Automation event handlers with a cache request. When an application raises an event, UI Automation fetches the requested properties at that moment. It delivers them together with the event. The name is one of these properties. Since #20608, the object NVDA creates for an event uses these cached values. Before that, the object ignored them. It asked the application for the name when NVDA handled the event. Such a request waits for the application's user interface thread. By then, the application has usually finished changing the name. NVDA 2026.2 therefore announced the new name. This pull request changes two things: 1. The object NVDA creates for a focus event no longer takes the name from the cached event values. The focus event handler passes a set of cached properties without the name. This set is `_focusEventCachedPropertyIDs` in `UIAHandler`. It is passed as `initialUIACachedPropertyIDs`. 2. When an object gains focus, NVDA already fetches several properties in one request to the application. The name is now part of that request. This set is `_focusPrefetchUIAPropertyIDs` on the UIA NVDAObject. NVDA now reads the name when it handles the focus event, as it did in 2026.2. The normal path makes no extra request, because the name joins a request NVDA already made. Code that reads the name earlier asks the application directly, as in 2026.2. Examples are overlay class selection and app modules. ### Testing strategy: The bug reproduces in File Explorer only occasionally, so File Explorer is not a reliable test. @FrayxRulez, could you please test a build of this pull request with Unigram 13.1.1 or earlier? ### Known issues with pull request: None
Author
Parents
Loading