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

If an input is required then the input does nog always get the required element #604

Closed
CharlieWinkwaves opened this issue Oct 14, 2021 · 0 comments · Fixed by #605
Closed

Comments

@CharlieWinkwaves
Copy link
Contributor

For example in the demo application email is a required field. validates :email, presence: true

<div class="form-group row"><label class="col-form-label col-sm-2 required" for="user_email">Email address</label><div class="col-sm-10"><input placeholder="Enter Email" class="form-control" type="email" name="user[email]" id="user_email"><small class="form-text text-muted">We'll never share your email with anyone else</small></div></div>
Then the label has an element required but the input has not. This means that when a screenreader reads the form is is not mentioned that the input is required.

If an input got the option required: true eq form.text_area :misc, required: true then the input field did get a required element

In BootstrapForm::FormGroupBuilder.form_group_builder_options and BootstrapForm::FormGroupBuilder.form_group_required. there is something done with required but it does not work how I expected it to work.

I added required and aria-required to all the input types, except the select.
Something in the BootstrapForm::Inputs::Select.select_with_bootstrap, from the form_group_builder it does get the options.
But when calling select_without_bootstrap(method, choices, options, html_options, &block) with the correct options it does not return required or aria-required.

I will add a PR with my changes

CharlieWinkwaves pushed a commit to CharlieWinkwaves/bootstrap_form that referenced this issue Oct 27, 2021
CharlieWinkwaves pushed a commit to CharlieWinkwaves/bootstrap_form that referenced this issue Nov 1, 2021
CharlieWinkwaves pushed a commit to CharlieWinkwaves/bootstrap_form that referenced this issue Nov 1, 2021
CharlieWinkwaves pushed a commit to CharlieWinkwaves/bootstrap_form that referenced this issue Dec 28, 2021
CharlieWinkwaves pushed a commit to CharlieWinkwaves/bootstrap_form that referenced this issue Dec 28, 2021
CharlieWinkwaves pushed a commit to CharlieWinkwaves/bootstrap_form that referenced this issue Dec 28, 2021
CharlieWinkwaves pushed a commit to CharlieWinkwaves/bootstrap_form that referenced this issue Dec 28, 2021
CharlieWinkwaves pushed a commit to CharlieWinkwaves/bootstrap_form that referenced this issue Dec 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant