Skip to content

Commit 12d2b5e

Browse files
author
Klaus Hartl
committed
Tabs should not use toggleClass() for state handling, fixes #4212
1 parent 3b1ce94 commit 12d2b5e

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

ui/ui.tabs.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -224,16 +224,25 @@ $.widget("ui.tabs", {
224224
this.$lis.add(this.$tabs).unbind('.tabs');
225225

226226
if (o.event != 'mouseover') {
227-
var handleState = function(state, el) {
227+
var addState = function(state, el) {
228228
if (el.is(':not(.ui-state-disabled)')) {
229-
el.toggleClass('ui-state-' + state);
229+
el.addClass('ui-state-' + state);
230230
}
231231
};
232-
this.$lis.bind('mouseover.tabs mouseout.tabs', function() {
233-
handleState('hover', $(this));
232+
var removeState = function(state, el) {
233+
el.removeClass('ui-state-' + state);
234+
};
235+
this.$lis.bind('mouseover.tabs', function() {
236+
addState('hover', $(this));
237+
});
238+
this.$lis.bind('mouseout.tabs', function() {
239+
removeState('hover', $(this));
240+
});
241+
this.$tabs.bind('focus.tabs', function() {
242+
addState('focus', $(this).closest('li'));
234243
});
235-
this.$tabs.bind('focus.tabs blur.tabs', function() {
236-
handleState('focus', $(this).closest('li'));
244+
this.$tabs.bind('blur.tabs', function() {
245+
removeState('focus', $(this).closest('li'));
237246
});
238247
}
239248

0 commit comments

Comments
 (0)