Skip to content

Commit

Permalink
Merge 9d13634 into 0b0bfb0
Browse files Browse the repository at this point in the history
  • Loading branch information
nvdaes authored Aug 13, 2024
2 parents 0b0bfb0 + 9d13634 commit c78e95c
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
14 changes: 10 additions & 4 deletions nvdaHelper/vbufBackends/gecko_ia2/gecko_ia2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1000,10 +1000,16 @@ VBufStorage_fieldNode_t* GeckoVBufBackend_t::fillVBuf(
}

BSTR value=NULL;
if(pacc->get_accValue(varChild,&value)==S_OK) {
if(value&&SysStringLen(value)==0) {
SysFreeString(value);
value=NULL;
if (pacc->get_accValue(varChild, &value) == S_OK) {
if (value) {
if (role == ROLE_SYSTEM_LINK) {
// For links, store the IAccessible value to handle same page link detection.
parentNode->addAttribute(L"IAccessible::value", value);
}
if (SysStringLen(value)==0) {
SysFreeString(value);
value=NULL;
}
}
}

Expand Down
22 changes: 22 additions & 0 deletions source/NVDAObjects/IAccessible/ia2Web.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,30 @@ def _get_states(self):
if popupState:
states.discard(controlTypes.State.HASPOPUP)
states.add(popupState)
if self.isInternalLink:
states.add(controlTypes.State.INTERNAL_LINK)
return states

@property
def isInternalLink(self) -> bool:
if self.role != controlTypes.Role.LINK:
return False
if (
not hasattr(self, "treeInterceptor")
or self.treeInterceptor is None
or not self.treeInterceptor.documentConstantIdentifier
):
return False
documentConstantIdentifier = self.treeInterceptor.documentConstantIdentifier
if documentConstantIdentifier.endswith("/"):
documentConstantIdentifier = documentConstantIdentifier[:-1]
queryParamCharPos = documentConstantIdentifier.find("?")
if queryParamCharPos > 0:
documentConstantIdentifier = documentConstantIdentifier[:queryParamCharPos]
if self.value.startswith(f"{documentConstantIdentifier}#"):
return True
return False

def _get_landmark(self):
xmlRoles = self.IA2Attributes.get("xml-roles", "").split(" ")
landmark = next((xr for xr in xmlRoles if xr in aria.landmarkRoles), None)
Expand Down
4 changes: 4 additions & 0 deletions source/controlTypes/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def negativeDisplayString(self) -> str:
HASPOPUP_GRID = setBit(48)
HASPOPUP_LIST = setBit(49)
HASPOPUP_TREE = setBit(50)
INTERNAL_LINK = setBit(51)


STATES_SORTED = frozenset([State.SORTED, State.SORTED_ASCENDING, State.SORTED_DESCENDING])
Expand Down Expand Up @@ -204,6 +205,9 @@ def negativeDisplayString(self) -> str:
State.HASPOPUP_LIST: _("opens list"),
# Translators: Presented when a control has a pop-up tree.
State.HASPOPUP_TREE: _("opens tree"),
# Translators: Presented when a link destination points to the page containing the link.
# For example, links of a table of contents of a document with different sections.
State.INTERNAL_LINK: _("same page"),
}


Expand Down

0 comments on commit c78e95c

Please sign in to comment.