Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support UIA LabeledBy property #17443

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions source/NVDAObjects/UIA/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

"""Support for UI Automation (UIA) controls."""

from __future__ import annotations
import typing
from typing import (
Generator,
Expand Down Expand Up @@ -2386,6 +2387,19 @@ def _get_controllerFor(self):
objList.append(obj)
return objList

def _get_labeledBy(self) -> UIA | None:
try:
val = self._getUIACacheablePropertyValue(UIAHandler.UIA_LabeledByPropertyId)
if not val or val == UIAHandler.handler.reservedNotSupportedValue:
return None
element = val.QueryInterface(UIAHandler.IUIAutomationElement).buildUpdatedCache(
UIAHandler.handler.baseCacheRequest,
)
return UIA(UIAElement=element)
except COMError:
pass
return super()._get_labeledBy()

def event_UIA_controllerFor(self) -> None:
return self.event_controllerForChange()

Expand Down
1 change: 1 addition & 0 deletions user_docs/en/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ Add-ons will need to be re-tested and have their manifest updated.
* Removed the requirement to indent function parameter lists by two tabs from NVDA's Coding Standards, to be compatible with modern automatic linting. (#17126, @XLTechie)
* Added the [VS Code workspace configuration for NVDA](https://nvaccess.org/nvaccess/vscode-nvda) as a git submodule. (#17003)
* In the `brailleTables` module, a `getDefaultTableForCurrentLang` function has been added (#17222, @nvdaes)
* Retrieving the `labeledBy` property now works for UIA elements supporting the corresponding `LabeledBy` UIA property. (#17442, @michaelweghorn)

#### API Breaking Changes

Expand Down