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

Fix issue #5591 - HTML 5 structural elements in IE #6044

Merged
merged 2 commits into from Jul 11, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions source/aria.py
Expand Up @@ -83,3 +83,10 @@
# Translators: Reported for a significant region, normally found on web pages.
"region": _("region"),
}

htmlNodeNameToAriaLandmarkRoles = {
"header": "banner",
"nav": "navigation",
"main": "main",
"footer": "contentinfo",
}
4 changes: 3 additions & 1 deletion source/virtualBuffers/MSHTML.py
Expand Up @@ -122,6 +122,7 @@ def _normalizeControlField(self,attrs):
# MSHTML puts the unavailable state on all graphics when the showing of graphics is disabled.
# This is rather annoying and irrelevant to our users, so discard it.
states.discard(controlTypes.STATE_UNAVAILABLE)
ariaRoles.append(aria.htmlNodeNameToAriaLandmarkRoles.get(nodeName.lower()))
Copy link
Contributor

@jcsteh jcsteh Jun 8, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: aria.htmlNodeNameToAriaLandmarkRoles.get might return None if there was no matching key. Having None in the ariaRoels list doesn't break anything right now, but it is odd and it might be confusing in future. Perhaps something like this:

lRole = aria.htmlNodeNameToAriaLandmarkRoles.get(nodeName.lower())
if lRole:
    ariaRoles.append(lRole)

# Get the first landmark role, if any.
landmark=next((ar for ar in ariaRoles if ar in aria.landmarkRoles),None)
ariaLevel=attrs.get('HTMLAttrib::aria-level',None)
Expand Down Expand Up @@ -292,7 +293,8 @@ def _searchableAttribsForNodeType(self,nodeType):
attrs = [
{"HTMLAttrib::role": [VBufStorage_findMatch_word(lr) for lr in aria.landmarkRoles if lr != "region"]},
{"HTMLAttrib::role": [VBufStorage_findMatch_word("region")],
"name": [VBufStorage_findMatch_notEmpty]}
"name": [VBufStorage_findMatch_notEmpty]},
{"IHTMLDOMNode::nodeName": [VBufStorage_findMatch_word(lr.upper()) for lr in aria.htmlNodeNameToAriaLandmarkRoles]}
]
elif nodeType == "embeddedObject":
attrs = {"IHTMLDOMNode::nodeName": ["OBJECT","EMBED","APPLET"]}
Expand Down