question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Checkboxes that share the same name in different forms cause violations

See original GitHub issue

I have two nearly identical login forms on the same page (one for the navbar, one for the page content). They are nearly identical because I can use the same javascript/selenium code to implement and test both.

The issue with this is that I get the following violation from AXE:

1) Checkbox inputs with the same name attribute value must be part of a group: https://dequeuniversity.com/rules/axe/3.1/checkboxgroup?application=axeAPI
  a) ["#homeLoginStayLoggedIn"]
    Fix any of the following:
      All elements with the name "stayLoggedIn" do not reference the same element with aria-labelledby
      Element does not have a containing fieldset or ARIA group

Nav login:

<div class="form-group">
    <div class="form-check">
        <input type="checkbox" class="form-check-input loginStayLoggedIn" id="navbarLoginStayLoggedIn" name="stayLoggedIn" form="navbarLogin">
        <label class="form-check-label" for="navbarLoginStayLoggedIn">
            Remember me
        </label>
    </div>
</div>

Homepage Login:

<div class="form-group">
    <div class="form-check">
        <input type="checkbox" class="form-check-input loginStayLoggedIn" id="homeLoginStayLoggedIn" name="stayLoggedIn" form="homeLogin">
        <label class="form-check-label" for="homeLoginStayLoggedIn">
            Remember me
        </label>
    </div>
</div>

These are part of entirely different forms in different parts of the page. Am I missing something, or is it a bug that AXE associates these inputs?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
GregJohnStewartcommented, Jul 28, 2020

Thanks! For anyone else looking for the direct link, here it is: https://unpkg.com/browse/axe-core@3.5.5/axe.min.js

I think it would be great to include on the axe-selenium-java readme, so others don’t get lost like me 😃

0reactions
stephenmathiesoncommented, Jul 28, 2020

@GregJohnStewart great idea! Feel free to open an PR!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Several Checkboxes sharing the same name
The browser sends them all, but they overwrite each other. So, setting the same name to several checkboxes can cause problems. Has it...
Read more >
Multiple checkboxes with the same name are not handled ...
If a set of checkboxes have the same name the HTML form encoding is different to those with different names.
Read more >
<input type="checkbox"> - HTML: HyperText Markup Language
The value attribute is one which all <input> s share; however, it serves a special purpose for inputs of type checkbox : when...
Read more >
Checkboxes vs. Radio Buttons
Radio buttons have lower cognitive load because they make all options permanently visible so that users can easily compare them. Radio buttons ...
Read more >
ANDI - Alerts
When ANDI is launched, it automatically analyzes every HTML element currently on the page looking for conditions that cause accessibility issues.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found