Skip to content

UIA: Property LabeledBy property not supported #17442

@michaelweghorn

Description

@michaelweghorn

UIA has a UIA_LabeledByPropertyId property, see https://learn.microsoft.com/en-us/windows/win32/winauto/uiauto-automation-element-propids :

Identifies the LabeledBy property, which is an automation element that contains the text label for this element.
This property can be used to retrieve, for example, the static text label for a combo box.
Variant type: VT_UNKNOWN
Default value: NULL

However, that one is currently not taken into account by NVDA's "labeledBy" property for objects, as can be seen for example with Qt's "calendarwidget" sample app when testing with a current Qt development version including an additional change that implements support for UIA_LabeledByPropertyId in Qt ( https://codereview.qt-project.org/c/qt/qtbase/+/606710 )

Similar bug report for IAccessible2: #17436

Steps to reproduce:

  1. start NVDA
  2. build Qt's qtbase module including an additional change that implements support for UIA_LabeledByPropertyId in Qt ( https://codereview.qt-project.org/c/qt/qtbase/+/606710 )
  3. run Qt's "calendarwidgets" sample app (qtbase/examples/widgets/widgets/calendarwidget/calendarwidget.exe)
  4. move focus to the "Locale" combobox
  5. open NVDA's Python console (Ctrl+Insert+Z)
  6. try to print the object that the currently focused edit is labelled by:
>>> focus.labeledBy
>>> focus.labeledBy == None
True

Actual behavior:

None is returned:

>>> focus.labeledBy
>>> focus.labeledBy == None
True

Expected behavior:

The label that is referenced by the UIA_LabeledByPropertyId property should be returned/printed in the Python console.

Directly querying that property instead of using the NVDAObject.labeledBy shows that the property actually returns a non-null element:

>>> focus.UIAElement.CurrentLabeledBy
<POINTER(IUIAutomationElement) ptr=0x9163578 at b8fb990>

NVDA logs, crash dumps and other attachments:

n/a

System configuration

NVDA installed/portable/running from source:

running from source

NVDA version:

git master as of commit c32e0e7

Windows version:

Windows 10 22H2

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

Qt's qtbase (git dev branch as of commit 850d4895be565931d18c92e5e2f9a33b7f26de6d) with additional change adding UIA_LabeledByPropertyId support in Qt ( https://codereview.qt-project.org/c/qt/qtbase/+/606710 )

Other information about your system:

n/a

Other questions

Does the issue still occur after restarting your computer?

n/a

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

NVDA 2024.3, same behavior

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

n/a

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

n/a

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

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions