When I want to switch between the main tabs in Firefox and Internet Explorer 9, it needs three clicks on the same tab to get there.

For example when I want to switch from "menu" to "shortcuts"

1st Click: nothing happens
2nd Click: submenu disappears
3rd Click: the right submenu appears

Everything works fine in latest Chrome, Safari and Opera

I tried it with the latest dev version from 2013-May-02 and 7.x-1.0-alpha10
underscore.js 1.4.4
backbone.js 1.0.0
jQuery 1.7

However, that doesnt happen when i use the spark distribution. In spark everything works fine.

Comments

rosberg’s picture

I am having the exact same problem (Firefox, IE9, and also in IE10).

designerbrent’s picture

Priority: Normal » Major

I'm also having the same problem with the dev version pulled October 22.

jessebeach’s picture

I've reproduced the error in both browsers.

Thank you for logging this error!

I'm looking into it now.

dangermonkey’s picture

I had the same issue but was able to fix it by updating to jQuery 1.7.1.

jessebeach’s picture

Oh, that's interesting. Any insight into what changed in jQuery 1.7.1 that would resolve this issue?

designerbrent’s picture

Wish I could say that did the trick for me but it's not the case. I'm running jQuery 1.7.1 as well as the most recent Backbone and Underscore libraries with a fairly recent version of NavBar and am still getting the same issue. It's only happening when you go to change tabs, not close the current tab. Closing the tab works normal.

jessebeach’s picture

Issue summary: View changes
StatusFileSize
new20.05 KB

Ok, so a couple things going on here. Navbar uses Backbone 1.0. Toolbar uses 0.9.2. So we often see bugs in Navbar that we will eventually encounter in Toolbar. The nice part is we get to fix them here first :).

The second part, is that this isn't really a Backbone bug...it's an Underscore bug. Here's the boiled-down proof:

The code from the image above:

current[attr] === val -> false
val -> a#navbar-item--4.navbar-icon /en/user
current[attr] -> a#navbar-item--3.navbar-icon /en/admi...shortcut
_.isEqual(current[attr], val) -> true

_.isEqual is incorrectly true when comparing two different DOM nodes. But this only happens in Firefox (~26) and IE (~9), not Chrome (~32).

So, we'll need to store a string or some value that isn't a DOM node as the value of the 'activeTab' model attribute.

jessebeach’s picture

This is also a known issue filed against Underscore: https://github.com/jashkenas/underscore/pull/945

jessebeach’s picture

Status: Active » Needs review
StatusFileSize
new1.84 KB

Alright, give this a go, please.

jessebeach’s picture

Issue tags: +beta-blocker
jessebeach’s picture

Issue tags: -beta-blocker +rc-blocker
designerbrent’s picture

The seems to do the trick!

designerbrent’s picture

I have noticed that while this does the trick for IE and Firefox when changing tabs, when you just want to close the tap, it is requiring one extra click.

jessebeach’s picture

StatusFileSize
new2.3 KB

@designerbrent, great catch. It came down to this code:

activeTab: document.getElementById(JSON.parse(localStorage.getItem('Drupal.navbar.activeTabID')))

The activeTab was being retrieved from localStorage and then fetched from the DOM and stored as a node. But I updated the code to store this value as a string representing the ID. So on the first page load, you would need to click on an active tab twice to dismiss it. I've fixed this problem.

The diff is attached. I've pushed the fix into the 7.x-1.x dev branch as well (08e5770e1e579ad167a63cb770d816a140adf7af).

tab

I'll also update #2139571: underscore.js fails to compare DOM nodes correctly; Toolbar JS will fail when upgraded to Backbone 1.0.0, since these codebases shouldn't diverge too much.

designerbrent’s picture

Status: Needs review » Reviewed & tested by the community

I'd say this fixes the issue. I tested in IE and Chrome this AM and it seem to have fixed all the issues for me.

jessebeach’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the follow-up review @designerbrent!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.