Skip to content

Fixed Edge landmark detection to work for Windows languages other than English#7333

Merged
michaelDCurran merged 5 commits into
nvaccess:masterfrom
BabbageCom:i7328
Jul 26, 2017
Merged

Fixed Edge landmark detection to work for Windows languages other than English#7333
michaelDCurran merged 5 commits into
nvaccess:masterfrom
BabbageCom:i7328

Conversation

@LeonarddeR

Copy link
Copy Markdown
Collaborator

Link to issue number:

Fixes #7328

Summary of the issue:

In Edge landmark reporting, NVDA relies on the localized landmark property. This breaks in languages other than English.

Description of how this pull request fixes the issue:

  1. Change the landmark detection mechanism to use UIA_LocalizedLandmarkTypePropertyId!=0 instead of UIA_LocalizedLandmarkTypePropertyId!=u""
  2. When the landmark type property is not 0, the node is a landmark or region, so use the aria role and get the localized landmark from aria.landmarkRoles
  3. Make sure the aria role is always converted to lower case, since people might capitalize them for an unknown reason, but Edge treats them as valid.

Testing performed:

See landmarkTest.html.txt

if not isinstance(self,EdgeHTMLRoot) and role==controlTypes.ROLE_PANE and self.UIATextPattern:
return controlTypes.ROLE_INTERNALFRAME
ariaRole=self._getUIACacheablePropertyValue(UIAHandler.UIA_AriaRolePropertyId)
ariaRole=self._getUIACacheablePropertyValue(UIAHandler.UIA_AriaRolePropertyId).lower()

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This change isn't related to landmark reporting, but since edge threads mixed case roles as valid, I had to convert the aria role to lower case for landmarks. Changed this here for consistency.

@michaelDCurran

Copy link
Copy Markdown
Member

What about the case where the author has provided multiple roles (one of them possibly being a landmark)? Important if you are ever passing ariaRole directly to aria.landmarkRoles.
See this article on multiple roles:
https://www.paciellogroup.com/blog/2015/10/notes-on-use-of-multiple-aria-role-attribute-values/

@LeonarddeR

Copy link
Copy Markdown
Collaborator Author

@michaelDCurran commented on 5 jul. 2017 07:59 CEST:

What about the case where the author has provided multiple roles (one of them possibly being a landmark)? Important if you are ever passing ariaRole directly to aria.landmarkRoles.

See this article on multiple roles:

https://www.paciellogroup.com/blog/2015/10/notes-on-use-of-multiple-aria-role-attribute-values/

So now I see where your code to split role comes from. I actually considered copying it, but I wasn't sure why. Let me investigate this later today or this week. Might be good to add a code comment that it is valid style to provide multiple aria roles

@LeonarddeR

Copy link
Copy Markdown
Collaborator Author

Though I was a bit reluctant to add a landmark property to EdgeNode initially, I decided to do it anyway. This is because we have at least two places where the landmark is retrieved, in the browse mode reporting case (EdgeTextInfo._getControlFieldForObject) and in the elements list. Not having a property for landmark would result in duplicate code to retrieve the aria roles, adequately split them and get the proper landmark role from it. My second rationale is in #6131 (comment).


def _get_landmark(self):
ariaRoles=self._getUIACacheablePropertyValue(UIAHandler.UIA_AriaRolePropertyId).lower()
landmarkId=self._getUIACacheablePropertyValue(UIAHandler.UIA_LandmarkTypePropertyId)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do you actually use landmarkID? I'd think you'd want to fetch this right at the top, and return early if this is 0 before even needing to fetch ariaRole

return True
return False

def _get_landmark(self):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A Docstring on this would be good as this is the base implementation.

michaelDCurran added a commit that referenced this pull request Jul 12, 2017
@michaelDCurran michaelDCurran merged commit 9807b03 into nvaccess:master Jul 26, 2017
@nvaccessAuto nvaccessAuto added this to the 2017.3 milestone Jul 26, 2017
michaelDCurran pushed a commit that referenced this pull request Aug 15, 2017
@LeonarddeR LeonarddeR added the BabbageWork Pull requests filed on behalf of Babbage B.V. label Oct 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BabbageWork Pull requests filed on behalf of Babbage B.V.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UIA: Reporting landmark shouldn't rely on localized landmark property

3 participants