-
-
Notifications
You must be signed in to change notification settings - Fork 636
Split interactive supports focus into tabbable and focusable cases #236
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
Split interactive supports focus into tabbable and focusable cases #236
Conversation
d71d1d0
to
cae5919
Compare
Tests should be passing now. I'd love a review! |
@jessebeach got you on a review tmrw! |
cae5919
to
4caf285
Compare
@@ -4,7 +4,9 @@ Elements with an interactive role and interaction handlers (mouse or key press) | |||
|
|||
## How do I resolve this error? | |||
|
|||
### Case: This element is a stand-alone control like a button, a link or a form element | |||
### Case: Elements with the '${role}' interactive role must be tabbable |
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.
'${role}'
?
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.
oh you're referencing the error message. i think this can be clearer:
#### Case: I got the error "Elements with the '${role}' interactive role must be tabbable." How can I fix this?
or something like that
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.
Great suggestion!
|
||
const schema = generateObjSchema(); | ||
const schema = generateObjSchema({ | ||
tabbable: enumArraySchema([ |
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.
can we use aria-query
for this? i.e. like ...roles.tabbable()
?
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.
It's just the interactives. I'll get those from aria-query.
JSXOpeningElement: ( | ||
node: JSXOpeningElement, | ||
) => { | ||
let tabbable = context.options |
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.
you should be able to make this a const with one line:
const tabbable = (context.options && context.options[0] && context.options[0].tabbable) || [];
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.
Lint complains here when mixing multiple &&
s and then finishing with ||
. I originally had it like you suggested.
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.
It complains even with the wrapping parens?
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.
It complains even with the wrapping parens?
Indeed, it does not!! Updated.
7fc62e6
to
d9418c4
Compare
@evcohen I've made the requested changes. |
d9418c4
to
3988e6b
Compare
Shall we get this in? |
3988e6b
to
a61c7e7
Compare
Rebased on current master branch. |
Any objections to merging 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.
LGTM!
a61c7e7
to
d856a7f
Compare
Updating the
interactive-supports-focus
rule to distinguish between elements that should have a tabindex of 0 (and thus be tabbable) and elements that should have a tabindex of -1 (and thus be focusable).We don't want to encourage developers to add
tabIndex="0"
willy-nilly to their components. Too many tabindices can create a degraded experience.The recommended set of roles that should be assigned a tabindex of 0 is given in the recommended settings: