Dropdown closes when clicking inside it


Topic: Dropdown closes when clicking inside it

aking pro asked 3 years ago

Your docs previously showed a way to control how a dropdown closes in response to the user clicking. I still see the option on the Dropdown API page but the description for how to use it is gone from the main Dropdown doc page.

I see the API option is data-mdb-autoClose="string" but I can't get it to work. From your doc examples it looks like enclosing the clickable dropdown content in a parent and using form-control wrapped inputs prevents the dropdown from closing on an inside click but I would prefer to have direct control over this without adding an unnecessary form elements. Where do I put the autoclose setting in the HTML for the dropdown? I want to set it to "outside"


Michał Duszak staff answered 3 years ago

Hello, I prepared a working example demo for you right here. data-mdb-auto-close="outside" must be an attribute of an element where the data-mdb-toggle is defined

https://mdbootstrap.com/snippets/standard/m-duszak/3383326


aking pro commented 3 years ago

ah I see - I was guessing at what the name of the attribute needed to be since it wasn't on the docs anymore. I was using "autoClose" instead of "auto-close". Thanks!


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
  • User: Pro
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: MDB5 3.9.0
  • Device: Macbook Pro
  • Browser: Chrome
  • OS: MacOS Catalina
  • Provided sample code: No
  • Provided link: No
Tags