-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
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
Checkbox with data-bs-toggle: Inconsistent state on double-click or reload #35667
Comments
I don't think we built the collapse plugin with checks/radios in mind. Would need to hear from @twbs/js-review. |
See also PR #22272 ; as far as I understand it was done with the explicit intent to support the combination of checkbox/radio + collapse. |
I think this was dropped for accessibility reasons: a checkbox has its own role and state, thus cannot convey role ans states needed for the collapse component. This is not something we should handle, IMHO. |
Closing per above comment. |
I think the above comment only said that the correct solution for this is not to support the use-case. The issue description proposes a second solution as well:
For instance, #22272 could be reverted. Or in the if-case that was inserted in that PR, a console.warning(...) could be emitted. |
Prerequisites
Describe the issue
Put data-bs-toggle on a checkbox like this:
Trigger the bug in one of the following two ways:
Observation: It is possible to get into one of these states, and then clicking on the checkbox will toggle between them, even though both are bad states:
Expected behavior: On page load and on interaction, the bad state should be detected and fixed (which combination is considered good is defined by the presence of the "checked" attribute). Or the developer experience should make it clear that this usage is not supported.
Reduced test cases
https://output.jsbin.com/lixazupoma
What operating system(s) are you seeing the problem on?
Linux
What browser(s) are you seeing the problem on?
Firefox
What version of Bootstrap are you using?
v5.1.3
The text was updated successfully, but these errors were encountered: