Choices icon indicating copy to clipboard operation
Choices copied to clipboard

Choices does not behave like other HTML elements in a disabled fieldset

Open tagliala opened this issue 9 months ago • 0 comments

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:

  1. Go to https://jsfiddle.net/tagliala/yetk9sgh/13/

Expected behavior Choices.js appears and behave like a disabled fieldset

Screenshots

image

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()
    }
  },

tagliala avatar Sep 12 '23 15:09 tagliala