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

feat(get-role): add noPresentational option #2549

Merged
merged 1 commit into from
Oct 15, 2020
Merged

feat(get-role): add noPresentational option #2549

merged 1 commit into from
Oct 15, 2020

Conversation

codingLogan
Copy link
Contributor

@codingLogan codingLogan commented Oct 9, 2020

Add option to getRole to return null if 'presentation' or 'none'
would be returned

Closes issue #1792

<< Describe the changes >>

Closes issue:

Reviewer checks

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

  • Follows the commit message policy, appropriate for next version
  • Code is reviewed for security

@CLAassistant
Copy link

CLAassistant commented Oct 9, 2020

CLA assistant check
All committers have signed the CLA.

@codingLogan codingLogan marked this pull request as ready for review October 9, 2020 17:32
@codingLogan codingLogan requested a review from a team as a code owner October 9, 2020 17:32
Add option to getRole to return null if 'presentation' or 'none'
would be returned

Closes issue #1792
@codingLogan codingLogan changed the title feat(commons/aria): add noPresentational option feat(get-role): add noPresentational option Oct 9, 2020
@straker
Copy link
Contributor

straker commented Oct 9, 2020

@WilcoFiers you'll need to review this as I consulted on it.

@straker straker added the hacktoberfest Help contribute during the month of October to participate https://hacktoberfest.digitalocean.com/ label Oct 9, 2020
Comment on lines +168 to +170
if (noPresentational && ['presentation', 'none'].includes(role)) {
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.

I think this would be better done as an "else if" here https://github.com/dequelabs/axe-core/pull/2549/files#diff-1bf6cc2da8acf89f4e8559d8254862d7L143 instead of in a separate function. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just to be sure I understand the suggestion clearly, I'll explain the reasoning behind my decisions.

I created the resolveRole(...) function from the understanding that the new option needs to handle whatever role gets returned from getRole(...). Since the original getRole(...) function had so many early returns, this was a great way for me to catch "whatever gets returned" as the role, and then apply the new option's behavior.

Let me know if that helps clarify why I did what I did. Thank you @WilcoFiers for your review

Copy link
Contributor

Choose a reason for hiding this comment

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

@Loganras You are absolutely right. @straker reminded me that implicitRole can return presentational too. My suggestion doesn't work. Let's go with this.

@codingLogan
Copy link
Contributor Author

@WilcoFiers , have you had a chance to review the comment I left earlier on your requested changes? I look forward to hearing from you with any suggestions you may have.

Comment on lines +168 to +170
if (noPresentational && ['presentation', 'none'].includes(role)) {
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.

@Loganras You are absolutely right. @straker reminded me that implicitRole can return presentational too. My suggestion doesn't work. Let's go with this.

@WilcoFiers
Copy link
Contributor

@Loganras Thank you for the contribution! Much appreciated.

@WilcoFiers WilcoFiers merged commit 4f39299 into dequelabs:develop Oct 15, 2020
@codingLogan
Copy link
Contributor Author

Thank you @WilcoFiers and @straker , it was my pleasure to contribute!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest Help contribute during the month of October to participate https://hacktoberfest.digitalocean.com/
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants