domino-ui icon indicating copy to clipboard operation
domino-ui copied to clipboard

DropdownButton click listener does not take disabled state into account

Open NickGaens opened this issue 2 years ago • 0 comments

Describe the bug After having disabled a DropdownButton instance, its click listener remains operative and disregards the disabled state.

DropdownButton.java:285:

private HTMLElement asDropDown() {
    buttonElement.addCss(ButtonStyles.DROPDOWN_TOGGLE);
    buttonElement.setAttribute("data-toggle", "dropdown");
    buttonElement.setAttribute("aria-haspopup", true);
    buttonElement.setAttribute("aria-expanded", true);
    buttonElement.setAttribute("type", "button");
    addClickListener(
        evt -> {
          DropDownMenu.closeAllMenus();
          open();
          evt.stopPropagation();
        });
    return buttonElement.element();
  }

To Reproduce Steps to reproduce the behavior:

  1. Create a DropdownButton and add at least one dropdown option.
  2. Click on the button -> the dropdown menu is shown as expected.
  3. Disable the button
  4. Click the button again -> the dropdown menu is shown again.

NickGaens avatar Jul 20 '22 15:07 NickGaens