Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncontrolled Dropdown #1713

Closed
ronaklalwaniii opened this issue Nov 23, 2019 · 1 comment
Closed

Uncontrolled Dropdown #1713

ronaklalwaniii opened this issue Nov 23, 2019 · 1 comment

Comments

@ronaklalwaniii
Copy link

Hello,

I want to create a multilevel uncontrolled dropdown menu (dropdown inside of dropdown) that opens on hover, how can I achieve that?

Regards

@TheSharpieOne
Copy link
Member

See twbs/bootstrap#21026 and twbs/bootstrap#16387 (comment)

It is not really possible with UncontrolledDropdown since the parent dropdowns do not know when to close when a child dropdown's item is selected. See this demo: https://stackblitz.com/edit/reactstrap-v8-fiulgx?file=Example.js

You'd need to use Dropdown itself to control the isOpen state of the dropdowns to close them all when an item is clicked within a nested dropdown.

There are also some styling issues, such as the outline and dropdown-item's padding not being clickable to toggle the nested dropdown. Those can be fixed with some custom styles.

We do support nested/multiple modals which bootstrap does not support. If someone wanted to open a PR which supports nested dropdowns, I would consider it. I imagine you'd have to use react's context api to provide the children with the parent's toggle function so that it could be called when the child calls its toggle. This would make it recursive when closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants