From ac2698772814ea8754bc9dc6008c7f1a7c87a955 Mon Sep 17 00:00:00 2001 From: Michael Curran Date: Thu, 30 Apr 2015 10:37:10 +1000 Subject: [PATCH] MSHTML: tighten up announcement of roles for some HTML5 tags where ARIA is used, and text nodes. Specifically: * text nodes now get a role of text (static text) rather than textFrame. * Text nodes can also now be reviewed again, by catching an exception. * NAV and SECTION tags now are mapped to a role of section, and ARTICLE is mapped to a role of document. Previously these were all textFrame or in some strange cases Edit!. This brings IE support inline with Firefox in these specific cases. Most importantly stops announcing all the content of these tags when focus moves inside them. --- source/NVDAObjects/IAccessible/MSHTML.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/source/NVDAObjects/IAccessible/MSHTML.py b/source/NVDAObjects/IAccessible/MSHTML.py index 36b58ae2bd2..51129e1bd81 100644 --- a/source/NVDAObjects/IAccessible/MSHTML.py +++ b/source/NVDAObjects/IAccessible/MSHTML.py @@ -56,6 +56,7 @@ def __getitem__(self,item): "A":controlTypes.ROLE_LINK, "LABEL":controlTypes.ROLE_LABEL, "#text":controlTypes.ROLE_STATICTEXT, + "#TEXT":controlTypes.ROLE_STATICTEXT, "H1":controlTypes.ROLE_HEADING, "H2":controlTypes.ROLE_HEADING, "H3":controlTypes.ROLE_HEADING, @@ -81,6 +82,9 @@ def __getitem__(self,item): "FIELDSET":controlTypes.ROLE_GROUPING, "OPTION":controlTypes.ROLE_LISTITEM, "BLOCKQUOTE":controlTypes.ROLE_BLOCKQUOTE, + "NAV":controlTypes.ROLE_SECTION, + "SECTION":controlTypes.ROLE_SECTION, + "ARTICLE":controlTypes.ROLE_DOCUMENT, } def getZoomFactorsFromHTMLDocument(HTMLDocument): @@ -647,8 +651,8 @@ def _get_role(self): if nodeName: if nodeName in ("OBJECT","EMBED","APPLET"): return controlTypes.ROLE_EMBEDDEDOBJECT - if self.HTMLNodeHasAncestorIAccessible or nodeName in ("BODY","FRAMESET","FRAME","IFRAME","LABEL"): - return nodeNamesToNVDARoles.get(nodeName,controlTypes.ROLE_TEXTFRAME) + if self.HTMLNodeHasAncestorIAccessible or nodeName in ("BODY","FRAMESET","FRAME","IFRAME","LABEL","NAV","SECTION","ARTICLE"): + return nodeNamesToNVDARoles.get(nodeName,controlTypes.ROLE_SECTION) if self.IAccessibleChildID>0: states=super(MSHTML,self).states if controlTypes.STATE_LINKED in states: @@ -873,7 +877,10 @@ def _get_table(self): def _get_HTMLNodeUniqueNumber(self): if not hasattr(self,'_HTMLNodeUniqueNumber'): - self._HTMLNodeUniqueNumber=self.HTMLNode.uniqueNumber + try: + self._HTMLNodeUniqueNumber=self.HTMLNode.uniqueNumber + except COMError: + return None return self._HTMLNodeUniqueNumber def _get_HTMLNodeName(self):