Checkboxes that share the same name in different forms cause violations
See original GitHub issueI 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:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

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-javareadme, so others don’t get lost like me 😃@GregJohnStewart great idea! Feel free to open an PR!