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 1 commit
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
13 changes: 13 additions & 0 deletions source/NVDAObjects/UIA/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2386,6 +2386,19 @@ def _get_controllerFor(self):
objList.append(obj)
return objList

def _get_labeledBy(self):
michaelweghorn marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -70,6 +70,7 @@ Specifically, MathML inside of span and other elements that have the attribute `
* Opening the NVDA Python Console will no longer fail in case an error occurs while retrieving snapshot variables. (#17391, @CyrilleB79)
* In Notepad and other UIA documents on Windows 11, if the last line is empty, the `braille next line command` will move the cursor to the last line.
In any document, if the cursor is on the last line, it will be moved to the end when using this command. (#17251, @nvdaes)
* In NVDA's Python console, retrieving the "labeledBy" property now works for UIA elements supporting the corresponding LabeledBy UIA property. (#17442, @michaelweghorn)
michaelweghorn marked this conversation as resolved.
Show resolved Hide resolved

### Changes for Developers

Expand Down