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

Add label to toggle's input for accessibility #186

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

FarisMarouane
Copy link

When running Web vitals test on a web page using react-toggle, the test complains that there's no accompanying label to the input.

You could surround the Toggle component with a label tag, but it messes up with the styling.

I am talking of cases where you don't need any visible label (before the toggle for instance).

This PR just add a label tag, with the already existing css class "react-toggle-screenreader-only"; before the input element when an id prop is specified. This is done to improve the library accessibility.

Thank you !

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.

1 participant