Topic: Dropdown menu disappears on click, even on items within form

lisablu2020 free asked 5 years ago


Expected behavior In Bootstrap 4, you can add a form element within a dropdown-menu, and clicking items within the form element will not cause the dropdown-menu to disappear.

For example:

<ul class="dropdown-menu">
    <form><div>Hi</div></form>
</ul>

The dropdown-menu will stay open even after clicking "Hi"

Actual behavior Angular MDB does not behave this way. Clicking items within a form element still caues the dropdown-menu to disappear.

Is there a way to prevent the dropdown-menu from disappearing when clicking on certain items within the menu?


Arkadiusz Idzikowski staff answered 5 years ago


You can prevent dropdown from closing with [autoClose]="false" input added to the element with mdbDropdown directive.

<div class="dropdown" mdbDropdown [autoClose]="false">


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: 7.4.1
  • Device: PC
  • Browser: Chrome
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No