bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

Dropdown is not working properly when contains a dropdown inside

Open artinheart opened this issue 11 years ago • 7 comments

I guess a child dropdown fires an event or smth that affects the parent dropdown http://plnkr.co/edit/Ddfgj4JGvhPj2cGwHC5o?p=preview

artinheart avatar Jul 17 '15 16:07 artinheart

Currently, the child dropdown will not toggle - you can observe this here.

wesleycho avatar Jul 22 '15 13:07 wesleycho

A main reason was a shared scope for both controllers - that's why DropdownController: scope.isOpen is affected (after assigning this flag to other property inside the scope or to the controller itself - it started working). I had to refactor dropdownService with the new property, but it broke auto-closing with "outsideClick" flag. There is a situation when toggle-event is fired on the child dropdown, but service has dropdownService: openScope as accumulated parent dropdown's scope.

artinheart avatar Sep 11 '15 14:09 artinheart

I fixed the issue. Will prepare PR.

artinheart avatar Sep 13 '15 20:09 artinheart

As noted in #2421, we will not support this due to the complexity this adds to supporting existing features & the amount of breaking code this will likely result in.

wesleycho avatar Oct 15 '15 05:10 wesleycho

Actually, I fixed it in JS, without any tricks with CSS or HTML. https://github.com/azahreba/bootstrap/commit/b86cbda99275670e27aa94f293423ee7cef303d7 (a simple factory pattern is used there). Now there are 2 failed unit-tests and that's the question - how to fix them. Because I've tried to reproduce those unit tests on the real app, and everything is working properly with class="open".

artinheart avatar Oct 22 '15 15:10 artinheart

Your commit is broken code - the dropdown service is already an instance when injected, so newing that will cause problems.

wesleycho avatar Oct 22 '15 15:10 wesleycho

Sorry, I sent a wrong commit. Check this one - https://github.com/azahreba/bootstrap/commit/4f01c590d07e72ab18b8eca1404d96f47f63c783

artinheart avatar Oct 22 '15 15:10 artinheart