Skip to content

Commit

Permalink
Add internal link state for some links in virtualBuffers
Browse files Browse the repository at this point in the history
  • Loading branch information
nvdaes committed Aug 13, 2024
1 parent 9d13634 commit 445be6c
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions source/virtualBuffers/gecko_ia2.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,20 @@ def _normalizeControlField(self, attrs): # noqa: C901
attrs["roleTextBraille"] = roleTextBraille
if attrs.get("IAccessible2::attribute_dropeffect", "none") != "none":
states.add(controlTypes.State.DROPTARGET)
if role == controlTypes.Role.LINK and controlTypes.State.LINKED not in states:
# This is a named link destination, not a link which can be activated. The user doesn't care about these.
role = controlTypes.Role.TEXTFRAME
if role == controlTypes.Role.LINK:
if controlTypes.State.LINKED not in states:
# This is a named link destination, not a link which can be activated. The user doesn't care about these.
role = controlTypes.Role.TEXTFRAME
else:
attrs["value"] = self.NVDAObjectAtStart.value
documentConstantIdentifier = self.obj.documentConstantIdentifier
value = attrs.get("value", "")
if (
value
and documentConstantIdentifier
and value.startswith(f"{documentConstantIdentifier}#")
):
states.add(controlTypes.State.INTERNAL_LINK)
level = attrs.get("IAccessible2::attribute_level", "")
xmlRoles = attrs.get("IAccessible2::attribute_xml-roles", "").split(" ")
landmark = next((xr for xr in xmlRoles if xr in aria.landmarkRoles), None)
Expand Down Expand Up @@ -210,6 +221,7 @@ def _normalizeControlField(self, attrs): # noqa: C901
attrs["detailsRoles"] = set(self._normalizeDetailsRole(detailsRoles))
if config.conf["debugLog"]["annotations"]:
log.debug(f"detailsRoles: {attrs['detailsRoles']}")
log.info(attrs)
return super()._normalizeControlField(attrs)

def _normalizeDetailsRole(self, detailsRoles: str) -> Iterable[Optional[controlTypes.Role]]:
Expand Down

0 comments on commit 445be6c

Please sign in to comment.