bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

Active li's within dropdown-submenu are not removed when a new tab is selected (my fix included)

Open ocrdeveloper opened this issue 13 years ago • 3 comments

Active li's within dropdown-submenu are not removed when a new tab is selected

Here is an example: http://jsfiddle.net/cspeak/HrXme/

How to reproduce

  • Select/Click "Tab 4.5.1" (Tab 4 -> Tab 4.5 -> tab 4.5.1)
  • Select/Click "Tab 4.5.2" (Tab 4 -> Tab 4.5 -> tab 4.5.2)
  • Go back to the "Tab 4.5" area and you will see both "Tab 4.5.1" and "Tab 4.5.1" are active.
  • Click on any other tab and both 4.5.1 and 4.5.2 are still active.

In the mean time, here is what I have implemented to get around this:

    $('body').delegate('.nav.nav-tabs a', 'click', function(e) {
        var $this = $(this);
        var $item = $(this).parent().find('ul.dropdown-menu');
        var $subCount = $item.length;
        if($subCount === 0){
            $this.tab("show");
            $this.parents('ul').find('li.active').removeClass('active');
            $this.parents('li').addClass('active');
            $item.addClass('active');
        }
    });

Example with fix (Updated 03/22/2013): http://jsfiddle.net/HrXme/3/

UPDATE: Platform/Browser Info

OS: Fedora 17 (x64) Browsers: Chrome 25.0.1364.97 beta / Firefox 19.0

ocrdeveloper avatar Feb 24 '13 01:02 ocrdeveloper

I can confirm w/ Chrome 25.0.1364.99 on Mac.

cvrebert avatar Feb 25 '13 23:02 cvrebert

I found a bug in my original fix. Updated my current fix as well as the jsfiddle link

ocrdeveloper avatar Mar 22 '13 21:03 ocrdeveloper

flyout menus aren't supported by the tab plugin. these will likely be removed in 3.0

fat avatar Jun 28 '13 02:06 fat