Skip to content

Commit 558c71a

Browse files
Merge f6899ce into afb8fce
2 parents afb8fce + f6899ce commit 558c71a

4 files changed

Lines changed: 48 additions & 21 deletions

File tree

nvdaHelper/vbufBackends/gecko_ia2/gecko_ia2.cpp

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,22 @@ VBufStorage_fieldNode_t* GeckoVBufBackend_t::fillVBuf(
422422
nhAssert(parentNode); //new node must have been created
423423
previousNode=NULL;
424424

425+
//get IA2Attributes -- IAccessible2 attributes;
426+
BSTR IA2Attributes;
427+
map<wstring,wstring> IA2AttribsMap;
428+
if(pacc->get_attributes(&IA2Attributes)==S_OK) {
429+
IA2AttribsToMap(IA2Attributes,IA2AttribsMap);
430+
SysFreeString(IA2Attributes);
431+
// Add each IA2 attribute as an attrib.
432+
for(map<wstring,wstring>::const_iterator it=IA2AttribsMap.begin();it!=IA2AttribsMap.end();++it) {
433+
s<<L"IAccessible2::attribute_"<<it->first;
434+
parentNode->addAttribute(s.str(),it->second);
435+
s.str(L"");
436+
}
437+
} else
438+
LOG_DEBUG(L"pacc->get_attributes failed");
439+
map<wstring,wstring>::const_iterator IA2AttribsMapIt;
440+
425441
//Get role -- IAccessible2 role
426442
long role=0;
427443
BSTR roleString=NULL;
@@ -438,6 +454,15 @@ VBufStorage_fieldNode_t* GeckoVBufBackend_t::fillVBuf(
438454
else if(varRole.vt==VT_BSTR)
439455
roleString=varRole.bstrVal;
440456
}
457+
458+
// Specifically force the role of ARIA treegrids from outline to table
459+
if(role == ROLE_SYSTEM_OUTLINE) {
460+
const auto IA2AttribsMapIt = IA2AttribsMap.find(L"xml-roles");
461+
if(IA2AttribsMapIt != IA2AttribsMap.end() && IA2AttribsMapIt->second.find(L"treegrid") != wstring::npos) {
462+
role = ROLE_SYSTEM_TABLE;
463+
}
464+
}
465+
441466
//Add role as an attrib
442467
if(roleString)
443468
s<<roleString;
@@ -495,22 +520,6 @@ VBufStorage_fieldNode_t* GeckoVBufBackend_t::fillVBuf(
495520
} else
496521
parentNode->addAttribute(L"keyboardShortcut",L"");
497522

498-
//get IA2Attributes -- IAccessible2 attributes;
499-
BSTR IA2Attributes;
500-
map<wstring,wstring> IA2AttribsMap;
501-
if(pacc->get_attributes(&IA2Attributes)==S_OK) {
502-
IA2AttribsToMap(IA2Attributes,IA2AttribsMap);
503-
SysFreeString(IA2Attributes);
504-
// Add each IA2 attribute as an attrib.
505-
for(map<wstring,wstring>::const_iterator it=IA2AttribsMap.begin();it!=IA2AttribsMap.end();++it) {
506-
s<<L"IAccessible2::attribute_"<<it->first;
507-
parentNode->addAttribute(s.str(),it->second);
508-
s.str(L"");
509-
}
510-
} else
511-
LOG_DEBUG(L"pacc->get_attributes failed");
512-
map<wstring,wstring>::const_iterator IA2AttribsMapIt;
513-
514523
//Check IA2Attributes, and or the role etc to work out if this object is a block element
515524
bool isBlockElement=TRUE;
516525
if(IA2States&IA2_STATE_MULTI_LINE) {
@@ -673,9 +682,10 @@ VBufStorage_fieldNode_t* GeckoVBufBackend_t::fillVBuf(
673682
} else {
674683
// If a node has children, it's visible.
675684
isVisible = width > 0 && height > 0 || childCount > 0;
676-
if ((role == ROLE_SYSTEM_LIST && !(states & STATE_SYSTEM_READONLY))
677-
|| role == ROLE_SYSTEM_OUTLINE
678-
) {
685+
// Only render the selected item for interactive lists.
686+
if (role == ROLE_SYSTEM_LIST && !(states & STATE_SYSTEM_READONLY)) {
687+
renderSelectedItemOnly = true;
688+
} else if(role == ROLE_SYSTEM_OUTLINE) {
679689
renderSelectedItemOnly = true;
680690
}
681691
if (IA2TextIsUnneededSpace

source/NVDAObjects/IAccessible/ia2Web.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ class BlockQuote(Ia2Web):
105105
role = controlTypes.ROLE_BLOCKQUOTE
106106

107107

108+
class Treegrid(Ia2Web):
109+
role = controlTypes.ROLE_TABLE
110+
111+
108112
class Article(Ia2Web):
109113
role = controlTypes.ROLE_ARTICLE
110114

@@ -215,6 +219,8 @@ def findExtraOverlayClasses(obj, clsList, baseClass=Ia2Web, documentClass=None):
215219
xmlRoles = obj.IA2Attributes.get("xml-roles", "").split(" ")
216220
if iaRole == IAccessibleHandler.IA2_ROLE_SECTION and obj.IA2Attributes.get("tag", None) == "blockquote":
217221
clsList.append(BlockQuote)
222+
elif iaRole == oleacc.ROLE_SYSTEM_OUTLINE and "treegrid" in xmlRoles:
223+
clsList.append(Treegrid)
218224
elif iaRole == oleacc.ROLE_SYSTEM_DOCUMENT and xmlRoles[0] == "article":
219225
clsList.append(Article)
220226
elif xmlRoles[0] == "region" and obj.name:

source/speech/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1910,6 +1910,18 @@ def getControlFieldSpeech( # noqa: C901
19101910
out = []
19111911
if ariaCurrent:
19121912
out.extend(ariaCurrentSequence)
1913+
# Speak expanded / collapsed / level for treeview items (in ARIA treegrids)
1914+
if role == controlTypes.ROLE_TREEVIEWITEM:
1915+
if controlTypes.STATE_EXPANDED in states:
1916+
out.extend(
1917+
getPropertiesSpeech(reason=reason, states={controlTypes.STATE_EXPANDED}, _role=role)
1918+
)
1919+
elif controlTypes.STATE_COLLAPSED in states:
1920+
out.extend(
1921+
getPropertiesSpeech(reason=reason, states={controlTypes.STATE_COLLAPSED}, _role=role)
1922+
)
1923+
if levelSequence:
1924+
out.extend(levelSequence)
19131925
if role == controlTypes.ROLE_GRAPHIC and content:
19141926
out.append(content)
19151927
types.logBadSequenceTypes(out)

source/virtualBuffers/gecko_ia2.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ def _normalizeControlField(self,attrs):
9494
# This is a named link destination, not a link which can be activated. The user doesn't care about these.
9595
role=controlTypes.ROLE_TEXTFRAME
9696
level=attrs.get('IAccessible2::attribute_level',"")
97-
98-
xmlRoles=attrs.get("IAccessible2::attribute_xml-roles", "").split(" ")
97+
xmlRoles = attrs.get("IAccessible2::attribute_xml-roles", "").split(" ")
9998
landmark = next((xr for xr in xmlRoles if xr in aria.landmarkRoles), None)
10099
if landmark and role != controlTypes.ROLE_LANDMARK and landmark != xmlRoles[0]:
101100
# Ignore the landmark role

0 commit comments

Comments
 (0)