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

[Fix] FileInput input-element visibility #875

Merged
merged 4 commits into from
Sep 11, 2024

Conversation

riitasointi
Copy link
Collaborator

@riitasointi riitasointi commented Sep 2, 2024

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

  • In single file mode, add visibility:hidden to the input wrapper element when a file is selected

@riitasointi riitasointi requested a review from LJKaski as a code owner September 2, 2024 11:01
@riitasointi riitasointi changed the title [Foc]FileInput visibility hidden in single file mode when file has been added [Fix] FileInput input-element visibility Sep 2, 2024
@riitasointi riitasointi force-pushed the fix/file-input-visibility branch from 8c42633 to e959bfd Compare September 2, 2024 12:20
@riitasointi riitasointi force-pushed the fix/file-input-visibility branch from e0df710 to 39b2e3e Compare September 6, 2024 10:39
Copy link
Contributor

@danielck danielck left a 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 {
Copy link
Contributor

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point, fixed now

Copy link
Collaborator

@LJKaski LJKaski left a 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! 👍

@riitasointi riitasointi merged commit b984c39 into develop Sep 11, 2024
1 check passed
@riitasointi riitasointi deleted the fix/file-input-visibility branch September 11, 2024 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants