Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion source/NVDAObjects/IAccessible/MSHTML.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,10 @@ def _get_treeInterceptorClass(self):
return super(MSHTML,self).treeInterceptorClass

def _get_isCurrent(self):
return self.HTMLAttributes["aria-current"]
isCurrent = self.HTMLAttributes["aria-current"]
if isCurrent == "false":
isCurrent = False
return isCurrent

def _get_HTMLAttributes(self):
return HTMLAttribCache(self.HTMLNode)
Expand Down
2 changes: 2 additions & 0 deletions source/NVDAObjects/IAccessible/ia2Web.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ def _get_positionInfo(self):

def _get_isCurrent(self):
current = self.IA2Attributes.get("current", False)
if current == "false":
current = False
return current

def _get_placeholder(self):
Expand Down
2 changes: 1 addition & 1 deletion source/NVDAObjects/UIA/edge.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ def _get_ariaProperties(self):
# in a list of strings like "something=true;current=date;". We want to capture one group, after the '='
# character and before the ';' character.
# This could be one of: True, "page", "step", "location", "date", "time"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you update this comment to add "false" as a valid value?

Copy link
Contributor

Choose a reason for hiding this comment

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

I also double checked in edge. True should be listed as "true"

RE_ARIA_CURRENT_PROP_VALUE = re.compile("current=(\w+);")
RE_ARIA_CURRENT_PROP_VALUE = re.compile("current=(?!false)(\w+);")
Copy link
Collaborator

@LeonarddeR LeonarddeR Jan 9, 2018

Choose a reason for hiding this comment

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

This regex seems a bit broken:

  1. RE_ARIA_CURRENT_PROP_VALUE.match("current=true;dummy=test;") properly matches
  2. RE_ARIA_CURRENT_PROP_VALUE.match("var=val;current=true;dummy=test;") does not match

May be we need a unit test for this. cc @feerrenrut


def _get_isCurrent(self):
ariaProperties=self._getUIACacheablePropertyValue(UIAHandler.UIA_AriaPropertiesPropertyId)
Expand Down
2 changes: 1 addition & 1 deletion source/NVDAObjects/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ def _get_statusBar(self):
def _get_isCurrent(self):
"""Gets the value that indicates whether this object is the current element in a set of related
elements. This maps to aria-current. Normally returns False. If this object is current
it will return one of the following values: True, "page", "step", "location", "date", "time"
it will return one of the following values: "true", "page", "step", "location", "date", "time"
"""
return False
Copy link
Contributor

Choose a reason for hiding this comment

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

Given this returns boolean False I think it would be best if we converted "true" to boolean True. Or perhaps better would be to return one off: None, 'true', 'page', etc


Expand Down
2 changes: 1 addition & 1 deletion source/virtualBuffers/MSHTML.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def _normalizeFormatField(self, attrs):
def _normalizeControlField(self,attrs):
level=None
ariaCurrent = attrs.get('HTMLAttrib::aria-current', None)
if ariaCurrent is not None:
if ariaCurrent not in (None, "false"):
attrs['current']=ariaCurrent
placeholder = self._getPlaceholderAttribute(attrs, 'HTMLAttrib::aria-placeholder')
if placeholder:
Expand Down
2 changes: 1 addition & 1 deletion source/virtualBuffers/gecko_ia2.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def _normalizeControlField(self,attrs):
attrs[attr]=int(attrVal)

current = attrs.get("IAccessible2::attribute_current")
if current is not None:
if current not in (None, 'false'):
attrs['current']= current
placeholder = self._getPlaceholderAttribute(attrs, "IAccessible2::attribute_placeholder")
if placeholder is not None:
Expand Down