Skip to content

Commit

Permalink
In Internet Explorer and other MSHTML controls, moving to specific he…
Browse files Browse the repository at this point in the history
…ading levels with single letter navigation now behaves as expected when the level of a heading is overridden for accessibility purposes (specifically, when aria-level overrides the level of an h tag).

Specifically:

* In the value lists  in the IterNodesByAttribs search dictionaries, None can now be included along side other values. I.e. Matches on these values or the absents of the attribute all together. Previously None could only be used by itself.
* When quick nav searching for a specific heading level, only match on a specific heading level tag if it does not have an aria-level.

Fixes #5434.
  • Loading branch information
michaelDCurran authored and jcsteh committed Dec 1, 2015
1 parent 2b2d29e commit b7e1fc7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
9 changes: 8 additions & 1 deletion source/virtualBuffers/MSHTML.py
Expand Up @@ -264,7 +264,14 @@ def _searchableAttribsForNodeType(self,nodeType):
if not config.conf["documentFormatting"]["includeLayoutTables"]:
attrs["table-layout"]=[None]
elif nodeType.startswith("heading") and nodeType[7:].isdigit():
attrs = [{"IHTMLDOMNode::nodeName": ["H%s" % nodeType[7:]]},{"HTMLAttrib::role":["heading"],"HTMLAttrib::aria-level":[nodeType[7:]]}]
attrs = [
# the correct heading level tag, with no overriding aria-level.
{"IHTMLDOMNode::nodeName": ["H%s" % nodeType[7:]],"HTMLAttrib::aria-level":['0',None]},
# any tag with a role of heading, and the correct aria-level
{"HTMLAttrib::role":["heading"],"HTMLAttrib::aria-level":[nodeType[7:]]},
# Any heading level tag, with a correct overriding aria-level
{"IHTMLDOMNode::nodeName": ["H1", "H2", "H3", "H4", "H5", "H6"],"HTMLAttrib::aria-level":[nodeType[7:]]},
]
elif nodeType == "heading":
attrs = [{"IHTMLDOMNode::nodeName": ["H1", "H2", "H3", "H4", "H5", "H6"]},{"HTMLAttrib::role":["heading"]}]
elif nodeType == "list":
Expand Down
11 changes: 4 additions & 7 deletions source/virtualBuffers/__init__.py
Expand Up @@ -79,19 +79,16 @@ def _prepareForFindByAttributes(attribs):
elif values[0] is VBufStorage_findMatch_notEmpty:
# There must be a value for this attribute.
optRegexp.append(r"(?:\\;|[^;])+;")
elif values[0] is None:
# There must be no value for this attribute.
optRegexp.append(r";")
elif isinstance(values[0], VBufStorage_findMatch_word):
# Assume all are word matches.
optRegexp.append(r"(?:\\;|[^;])*\b(?:")
optRegexp.append("|".join(escape(val) for val in values))
optRegexp.append(r")\b(?:\\;|[^;])*;")
else:
# Assume all are exact matches.
optRegexp.append("(?:")
optRegexp.append("|".join(escape(val) for val in values))
optRegexp.append(");")
# Assume all are exact matches or None (must not exist).
optRegexp.append("(?:" )
optRegexp.append("|".join((escape(val)+u';') if val is not None else u';' for val in values))
optRegexp.append(")")
regexp.append("".join(optRegexp))
return u" ".join(reqAttrs), u"|".join(regexp)

Expand Down
1 change: 1 addition & 0 deletions user_docs/en/changes.t2t
Expand Up @@ -7,6 +7,7 @@

== Bug Fixes ==
- In iTunes 12, browse mode now updates correctly when a new page loads in the iTunes Store. (#5191)
- In Internet Explorer and other MSHTML controls, moving to specific heading levels with single letter navigation now behaves as expected when the level of a heading is overridden for accessibility purposes (specifically, when aria-level overrides the level of an h tag). (#5434)


= 2015.4 =
Expand Down

0 comments on commit b7e1fc7

Please sign in to comment.