Radio buttons & checkboxes do not have unique ID attributes
See original GitHub issueAre you requesting a feature, reporting a bug or asking a question?
Reporting a bug
What is the current behavior?
The radio buttons and checkboxes that belong to the same group all have the same ID attribute, when instead IDs should be unique.
What is the expected behavior?
The individual radio buttons/checkboxes should either have different IDs, or the ID should maybe be moved to the containing <fieldset>
tag.
How would you reproduce the current behavior (if this is a bug)?
Visit any survey with a radiogroup or checkbox question.
Provide the test code and the tested page URL (if applicable)
Tested page URL: sample radio group in the documentation
Specify your
- browser: Chrome
- browser version: 69.0.3497.100
- surveyjs platform (angular or react or jquery or knockout or vue): react
- surveyjs version: 1.0.53
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Should the id tag be unique in checkbox forms? - Stack Overflow
According to freecodecamp in their checkbox exercise all checkbox elements should have the same name and id,. No. It says they should have...
Read more ><input type="radio"> - HTML: HyperText Markup Language
Where multiple controls exist, radio buttons allow one to be selected out of them all, whereas checkboxes allow multiple values to be selected....
Read more >Grouping Controls | Web Accessibility Initiative (WAI) - W3C
The legend for a group of controls can also highlight common attributes of all controls, for example, to advise that all fields in...
Read more >Add a theme_form_element()/theme_fieldset() function that ...
Hi, I have been using this module and it is excellent! In an attempt to skin the checkboxes and radio buttons (including the...
Read more >Accessible Forms - Checkboxes and Radio Buttons
Checkboxes and radio buttons can impact web form accessibility if they're not used correctly. Learn how to use them and avoid the pitfalls....
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 FreeTop 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
Top GitHub Comments
@zech the bug fixed via the https://github.com/surveyjs/survey-library/commit/f7986e09d033273614184c652f1d1bfb68cf1867. Fix will be available in the next minor release. Thank you for the reporting.
Hi,
I think at least for RadioButtons this bug is introduced (again). We’re using it with React and a column count of 4 and it triggers warnings in console.
I suspect this code is the issue because the index is not respecting the column count (ci) in line 49:
https://github.com/surveyjs/survey-library/blob/595c8fc065d30b7070367046d9e70f8d84bffa20/src/react/reactquestionradiogroup.tsx#L48-L50
Tagging @dmitrykurmanov. I hope it’s okay to append it to an existing issue.