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

Form field has aria-invalid attribute when error is false #4042

Closed
aoelen opened this issue Aug 19, 2020 · 3 comments · Fixed by #4043
Closed

Form field has aria-invalid attribute when error is false #4042

aoelen opened this issue Aug 19, 2020 · 3 comments · Fixed by #4043

Comments

@aoelen
Copy link
Contributor

aoelen commented Aug 19, 2020

Bug Report

Steps

Use a form field, for example:
<Form.Field id='form-input-control-error-email' control={Input} label='Email' placeholder='[email protected]' error={false} />

Expected Result

The aria-invalid attribute should not be present (or should be false)

Actual Result

The aria-invalid attribute is set to true:

<input aria-describedby="form-input-control-error-email-error-message" aria-invalid="true" placeholder="[email protected]" id="form-input-control-error-email" type="text">

Version

1.2.0

@layershifter
Copy link
Member

Thanks for reporting. It seems that condition there should be simpler 🐱

src/collections/Form/FormField.js

    'aria-describedby': ariaDescribedBy,
-   'aria-invalid': error !== undefined ? true : undefined,
+   'aria-invalid': error ? true : undefined,

Would you like to submit a PR?

@aoelen
Copy link
Contributor Author

aoelen commented Aug 19, 2020

Done, I added some tests as well

@layershifter
Copy link
Member

A fix was released in [email protected] 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants