-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[Form] Add tabIndex={-1} to implicit submit form #2447
Conversation
@dpersing once you confirm that this in fact the behavior we want I'll update the changelog. |
💦 Potential splash zone of changes introduced to
DetailsAll files potentially affected (total: 3)📄
|
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.
This is an okay temporary fix. I'm curious as to why we're using visually hidden styles on a component that users aren't meant to interact with, however.
Hiding with display: none
or hidden
would avoid having to apply aria-hidden="true"
and tabindex="-1"
.
I believe is so that the form does submit by simply clicking enter as oppose to actually clicking on the button. Display none wouldn't have the same effect because the button would not be in the DOM. If this is a temporary fix, what would the right fix be? |
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.
Display none wouldn't have the same effect because the button would not be in the DOM.
Oh boy, you're right, now that I've reread the whole thing. 🤦♀ Let'er rip. 🎉
Would it help consumers to see an example in the style guide, or is this an edge case we want to discourage? |
7a39663
to
94e292e
Compare
I'm not sure it's worth it because it is the default behavior. I'm guessing a safeguard for when people add more than 1 field and no submit button is present, clicking enter would not trigger the on submit. |
94e292e
to
53206c7
Compare
WHY are these changes introduced?
While doing an a11y audit on our Form component I found that our Form component is failing because
ARIA hidden element must not contain focusable elements
.Our Form contains an implicitSubmit prop which generates a visually hidden submit button with aria-hidden set to true.
WHAT is this pull request doing?
adds a tabIndex={-1} to our Form implied submit button.
How to 🎩
Using Fast pass on the Accessibility extension for web ensure there are no errors with the playground below.
Copy-paste this code in
playground/Playground.tsx
:🎩 checklist
README.md
with documentation changes