Ngx-bootstrap: Dropdown autoClose not working with manual triggering

Created on 19 Dec 2018  路  6Comments  路  Source: valor-software/ngx-bootstrap

Bug description or feature request:

The manual triggering of the BsDropdownDirective is not working when the autoClose option is set. Calling toggle, show or hide shows no effect. I'd expect these methods to work as usual and the autoClose option to apply. Both features should work independently and in combination.

Plunker/StackBlitz that reproduces the issue:

https://stackblitz.com/edit/ngx-bootstrap-yigrz6

Versions of ngx-bootstrap, Angular, and Bootstrap:

ngx-bootstrap: 3.1.2

Angular: 7.1.0

Bootstrap: 3

comp(dropdown)

Most helpful comment

why is this closed if still isn't working?

All 6 comments

@fynnfeldpausch you are absolutely right because if you set autoClose equal true you said to the app: "Please close a dropdown when I make click on any element if this element isn't a dropdown menu."

@svetoldo4444ka I don't see the contradiction here. Why can't I manually show a dropdown and - once it is visible - have it close on click if the clicked element isn't a dropdown menu?

@fynnfeldpausch you can do something like this:
joxi_screenshot_1545310300904
joxi_screenshot_1545310452946

Agreed, this is the sort of workaround I am using now. However, I do think that the behavior is inconsistent and should be fixed. But this is a matter of perspective...

It's rather a hack in user code, or hack in ngx component, which will stop propogation if autoclose true, which should be optional cuz not obvious

why is this closed if still isn't working?

Was this page helpful?
0 / 5 - 0 ratings