-
Notifications
You must be signed in to change notification settings - Fork 15
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] FileInput input-element visibility #875
Conversation
8c42633
to
e959bfd
Compare
e0df710
to
39b2e3e
Compare
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.
Typo needs to be fixed: change fi-file-input_input_wrapper--hidden
to fi-file-input_input-wrapper--hidden
in CSS. Due to this the wrapper containing the input and label is still available to screen readers.
@@ -143,6 +143,10 @@ export const baseStyles = ( | |||
display: flex; | |||
align-items: center; | |||
|
|||
&.fi-file-input_input_wrapper--hidden { |
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.
The classname in CSS and in FileInput.tsx do not match. input_wrapper--hidden
(here) vs input-wrapper--hidden
(in FileInput.tsx). The former is used consistently in CSS but the latter form (with a hyphen between input and wrapper) would match the class used for the base state of the wrapper.
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.
Good point, fixed now
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.
Seems to do the trick! 👍
Description
PR adds a
visibility:hidden
statement to<FileInput>
s input wrapper element when the component is in single file mode and a file has been selected. Therefore the input is not browseable with screen readers.This change mandated a small timeout to be added to the moving of focus from the remove file button back to the input. Similar timeout hax are used throughout the component involving the moving of focus.
Motivation and Context
This change was suggested by an accessibility expert.
How Has This Been Tested?
macOS Styleguidist Chrome + Safari
Release notes
FileInput
visibility:hidden
to the input wrapper element when a file is selected