Choices
Choices copied to clipboard
Choices does not behave like other HTML elements in a disabled fieldset
Describe the bug
It is expected that HTML elements are disabled in a globally disabled fieldset
Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/fieldset#attributes
If this Boolean attribute is set, all form controls that are descendants of the
<fieldset>
, are disabled, meaning they are not editable and won't be submitted along with the<form>
. They won't receive any browsing events, like mouse clicks or focus-related events. By default browsers display such controls grayed out. Note that form elements inside the<legend>
element won't be disabled.
To Reproduce Steps to reproduce the behavior:
- Go to https://jsfiddle.net/tagliala/yetk9sgh/13/
Expected behavior Choices.js appears and behave like a disabled fieldset
Screenshots
Desktop (please complete the following information):
- OS: macOS 13.5.2
- Browser Chrome / Safari / Edge
- Version: latest
Additional context On Firefox, the element is not interactable but it looks like an interactable field
Workaround
callbackOnInit: function () {
// Workaround for Choices-js/Choices#1132
if (this.passedElement.element.closest('fieldset:disabled')) {
this.disable()
}
},