Skip to content

UIA notification event handling: NVDA gives up if cached native window handle is not found despite its presence via runtime ID #16871

@josephsl

Description

@josephsl

Hi,

May have found a contributing factor for #16862: NVDA gives up if native window handle is not found despite its presence in UIA runtime ID.

Steps to reproduce:

Same as #16862 and add (be sure to run NVDA with debug logging enabled):

  1. While focused on a button such as "microphone active/sleep" in Voice Access, open Python Console and type the first code fragment, then close python console.
  2. Try pressing Space to toggle microphone.

Code fragment from item 1:

import UIAHandler
UIAHandler.handler.getNearestWindowHandle(focus.UIAElement)

Actual behavior:

NVDA does not announce microphone toggle button yet native window handle is present based on the code fragment output.

Expected behavior:

NVDA announces microphone toggle after noticing that a native window handle is indeed present.

NVDA logs, crash dumps and other attachments:

See #16862.

System configuration

NVDA installed/portable/running from source:

Installed

NVDA version:

alpha-32932,b94415e8

Windows version:

Windows 11 24H2 preview (build 26100.1150)

Name and version of other software in use when reproducing the issue:

Voice Access 24H2

Other information about your system:

Used as a development workstation

Other questions

Does the issue still occur after restarting your computer?

Yes

Have you tried any other versions of NVDA? If so, please report their behaviors.

Reproducible in 2024.1, 2024.2, 204.3 beta 3 and earlier releases

If NVDA add-ons are disabled, is your problem still occurring?

Yes

Does the issue still occur after you run the COM Registration Fixing Tool in NVDA's tools menu?

Not applicable

Possible solution:

In UIA handler's notification event handler, check that a native window handle can be fetched (call getNearestWindowHandle, and if None is returned, check UIA runtime ID (sometimes an empty tuple might be returned)). Like other event handlers, use the just obtained window handle as part of UIA object constructor call.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions