-
Notifications
You must be signed in to change notification settings - Fork 784
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(nested-interactive/aria-text): allow "tabindex=-1" on elements with no role #3165
Conversation
Make `internal-link-present-evaluate` work with virtualNode rather than actualNode. Closes issue dequelabs#2466
This reverts commit 9f996bc.
…ractive" Closes issue dequelabs#2934
"ci/circleci: test_win — Your tests failed on CircleCI" - I can't tell if that test failed because of my changes, or if it was going to fail anyway. code owners - let me know if I should do anything. |
@dan-tripp Thanks for fixing this! Fails: <button>
Test
<svg class="icon" tabindex="-1" role="presentation">...</svg>
</button> Works: <button>
Test
<svg class="icon" role="presentation">...</svg>
</button> Codepen: Is this something you are willing to include in this PR? I can also create a separate issue. |
@bastilimbach I'd be happy to, and that change seems sensible to me. However, I'm new here, so I think that I had better leave it to the core team to decide what the desired behaviour ought to be. If it's not too much trouble, could you create a new issue and tag me? Then I'll try to make a separate PR for your new issue, if it gets some approval from the core team. |
@bastilimbach so with <ul>
<li tabindex="-1" role="presentation">World</li>
</ul> Chrome - Treats the li element as a The reason is that because of the tabindex the element can be focused programmatically which means that screen readers must announce a role for the element (it can't be presentational). |
@dan-tripp Thanks for taking on this pr. I've been trying to figure out if there were any problems with allowing The reason for that is that this change directly affects the If this change only affected the |
@dan-tripp I believe this pr is replaced by #3194, since we don't want tabindex=-1 to pass but now warn of the problem. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright. Discussed with @WilcoFiers after thoroughly testing things. Testing both role="text
and interactive roles (.e.g role="button"
), we've determined that a tabindex can be allowed under certain conditions. Basically if the element with the tabindex is not a widget role, then tabindex on the element is fine. Otherwise we should still flag it as we do now.
So something like this:
// no-focusable-content-evaluate.js
import { getRole, getRoleType } from '../../commons/aria';
function getFocusableDescendants(vNode) {
if (!vNode.children) {
if (vNode.props.nodeType === 1) {
throw new Error('Cannot determine children');
}
return [];
}
const retVal = [];
vNode.children.forEach(child => {
const role = getRole(child);
if(getRoleType(role) === 'widget' && isFocusable(child)) {
retVal.push(child);
} else {
retVal.push(...getFocusableDescendants(child));
}
});
return retVal;
}
My latest commits on this PR are ready for review. Let me know what you think. And thank you for your patience. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Close, couple more minor things
This reverts commit 9f996bc.
…ractive" Closes issue dequelabs#2934
Okay, I think this PR is ready for review again. Thank you for all your suggested changes, @WilcoFiers - I think that I'm getting the hang of this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed for security
@dan-tripp Thank you so much for this contribution! Great work, really appreciate it. |
Great! Glad I can help. |
Closes issue: #2934