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: flag hidden elms with disallowed role(s) for review #1225

Merged
merged 7 commits into from
Nov 13, 2018

Conversation

jeeyyy
Copy link
Contributor

@jeeyyy jeeyyy commented Nov 7, 2018

This PR does the below for the rule aria-allowed-role

  • Note: The rule spec does not exclude hidden elements excludeHidden: false (this is by choice).
  • Change has been put in to flag elements as needs review, which are hidden (via CSS and to screen readers), and have redundant/ disallowed roles.

Closes issue:

Reviewer checks

Required fields, to be filled out by PR reviewer(s)

  • Follows the commit message policy, appropriate for next version
  • Has documentation updated, a DU ticket, or requires no documentation change
  • Includes new tests, or was unnecessary
  • Code is reviewed for security by @WilcoFiers

@jeeyyy jeeyyy requested a review from a team November 7, 2018 15:19
@@ -18,6 +19,10 @@ const unallowedRoles = axe.commons.aria.getElementUnallowedRoles(

if (unallowedRoles.length) {
this.data(unallowedRoles);
if (!dom.isVisible(node, true)) {
// flag hidden elements for review
return null;
Copy link
Contributor

Choose a reason for hiding this comment

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

This should return undefined. I know this also works, but we should do this consistently.

@@ -3,6 +3,7 @@
* https://www.w3.org/TR/html-aria/#docconformance
* https://www.w3.org/TR/SVG2/struct.html#implicit-aria-semantics
*/
const { dom } = axe.commons;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add an "inapplicable" message to the check JSON so that we communicate with the user what's going on.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@WilcoFiers

I have gone with below. Let me know if you have suggestions.

"incomplete": "Element is not visible, and ARIA role{{=it.data && it.data.length > 1 ? 's' : ''}} {{=it.data.join(', ')}} {{=it.data && it.data.length > 1 ? 'are' : ' is'}} not allowed for given element"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jeeyyy jeeyyy requested review from marcysutton, WilcoFiers and a team November 8, 2018 14:33
@@ -9,7 +9,8 @@
"impact": "minor",
"messages": {
"pass": "ARIA role is allowed for given element",
"fail": "role{{=it.data && it.data.length > 1 ? 's' : ''}} {{=it.data.join(', ')}} {{=it.data && it.data.length > 1 ? 'are' : ' is'}} not allowed for given element"
"fail": "role{{=it.data && it.data.length > 1 ? 's' : ''}} {{=it.data.join(', ')}} {{=it.data && it.data.length > 1 ? 'are' : ' is'}} not allowed for given element",
"incomplete": "Element is not visible, and ARIA role{{=it.data && it.data.length > 1 ? 's' : ''}} {{=it.data.join(', ')}} {{=it.data && it.data.length > 1 ? 'are' : ' is'}} not allowed for given element"
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd suggest something along the lines of "Role(s) {roles} must be removed when the element is made visible, as it is not allowed for the element"

@@ -51,6 +51,32 @@ describe('aria-allowed-role', function() {
);
});

it('returns undefined (needs review) when element is hidden and has redundant role', function() {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not a "redundant role".

assert.isUndefined(actual);
});

it('returns undefined (needs review) when element is with in hidden parent and has redundant role', function() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, not a "redundant role".

@jeeyyy jeeyyy merged commit bdff141 into develop Nov 13, 2018
@jeeyyy jeeyyy deleted the fix-aria-allowed-role branch November 13, 2018 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants