Topic: Dropdown does not follow controlled open state

OllyJS free asked 1 week ago


A parent button sets the dropdown state to true. The menu still opens only through its own trigger.

Which supported prop controls visibility from outside?


Mateusz Lazaru staff answered 1 week ago


Please share the exact MDBDropdown JSX and the name of the state prop you pass. For this component, an option that opens the menu when it mounts is not necessarily a fully controlled visibility API. A parent state update can therefore occur without changing an already mounted menu.

Please include the external trigger and whether the normal dropdown toggle still works in a minimal reproduction. That will let us trace how the visibility state reaches the menu and recommend a solution that preserves keyboard and focus handling.

https://mdbootstrap.com/docs/react/components/dropdowns/



Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Answered

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB React
  • MDB Version: MDB5 9.0.0
  • Device: Desktop
  • Browser: Edge
  • OS: macOS
  • Provided sample code: No
  • Provided link: No