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 IAccessible2 labelled-by relation #17437

1 change: 1 addition & 0 deletions source/IAccessibleHandler/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ class RelationType(str, enum.Enum):
CONTROLLER_FOR = "controllerFor"
ERROR = "error"
ERROR_FOR = "errorFor"
LABELLED_BY = "labelledBy"
9 changes: 8 additions & 1 deletion source/NVDAObjects/IAccessible/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1163,12 +1163,19 @@ def isPointInObject(self, x, y):
return True

def _get_labeledBy(self):
label = self._getIA2RelationFirstTarget(IAccessibleHandler.RelationType.LABELLED_BY)
if label:
return label

try:
(pacc, accChild) = IAccessibleHandler.accNavigate(
ret = IAccessibleHandler.accNavigate(
self.IAccessibleObject,
self.IAccessibleChildID,
IAccessibleHandler.NAVRELATION_LABELLED_BY,
)
if not ret:
return None
(pacc, accChild) = ret
obj = IAccessible(IAccessibleObject=pacc, IAccessibleChildID=accChild)
return obj
except COMError:
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 objects in applications implementing the "labelled-by" IAccessible2 relation and no longer triggers an error. (#17436, @michaelweghorn)

### Changes for Developers

Expand Down