Skip to content

Conversation

@sharshenov
Copy link
Contributor

First of all, thank you (all contributors of this project) for the excellent gem. I use it in all projects with bootstrap 🥇

There is a problem with default role attribute of generated form. W3C validator shows a warning for role="form" attribute of form tag:

The form role is unnecessary for element form.

Steps to reproduce:

  1. Open W3C validator with text input
  2. Paste code below
  3. Inspect warning
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>title</title>
  </head>
  <body>
    <form role="form">
      <button>submit</button>
    </form>
  </body>
</html>

Explanation why the validator raises the warning.

This PR drops default form role attribute, but still allows to set role attribute explicitly:

bootstrap_form_for(@user, html: { role: "not-a-form" }) { |_f| nil }

Fixes warning of W3C validator:
The "form" role is unnecessary for element "form".

https://stackoverflow.com/questions/35397871/role-attribute-obsolete-in-form-or-nav-tags
Copy link
Contributor

@lcreid lcreid left a comment

Choose a reason for hiding this comment

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

Thanks very much for the PR! I really like any idea that helps bootstrap_form be more accessible.

My only concern is for backwards-compatibility. I would prefer not to break someone's application on the odd chance that they're using the role="form" in come way in their application.

I like that bootstrap_form doesn't need any configuration to get started, aside from adding the gem to the bundle. But we're getting to the point where it might be a good idea.

I created #561 to ask for a PR for configuration options. What do you think if we implement a configuration option via #561 , and then modify this PR to work based on a configuration option?

Again, thanks for the PR, and for the kind words about the gem.

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.

2 participants