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:
- start NVDA
- 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 )
- run Qt's "calendarwidgets" sample app (
qtbase/examples/widgets/widgets/calendarwidget/calendarwidget.exe)
- move focus to the "Locale" combobox
- open NVDA's Python console (Ctrl+Insert+Z)
- 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
UIA has a
UIA_LabeledByPropertyIdproperty, see https://learn.microsoft.com/en-us/windows/win32/winauto/uiauto-automation-element-propids :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_LabeledByPropertyIdin Qt ( https://codereview.qt-project.org/c/qt/qtbase/+/606710 )Similar bug report for IAccessible2: #17436
Steps to reproduce:
UIA_LabeledByPropertyIdin Qt ( https://codereview.qt-project.org/c/qt/qtbase/+/606710 )qtbase/examples/widgets/widgets/calendarwidget/calendarwidget.exe)Actual behavior:
Noneis returned:Expected behavior:
The label that is referenced by the
UIA_LabeledByPropertyIdproperty should be returned/printed in the Python console.Directly querying that property instead of using the
NVDAObject.labeledByshows that the property actually returns a non-null element: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_LabeledByPropertyIdsupport 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