aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2011-09-06 13:01:01 -0400
committerScott González <scott.gonzalez@gmail.com>2011-09-06 13:01:01 -0400
commitc1cda180a93a6c0a63cf21a68dacb54233e03d03 (patch)
tree883cb1116c143e01929e22b755263f5e59272a19 /ui
parent08450c3b2dfa652c7866653af93566c9bfa2f2cb (diff)
downloadjquery-ui-c1cda180a93a6c0a63cf21a68dacb54233e03d03.tar.gz
jquery-ui-c1cda180a93a6c0a63cf21a68dacb54233e03d03.zip
Tabs: Find panels using aria-controls instead of index for remove method. Fixes #7698 - Panels do not sort when a tab is sorted which can cause a mismatch error when a tab is removed.
Diffstat (limited to 'ui')
-rw-r--r--ui/jquery.ui.tabs.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js
index d4c5f6b69..a1bf72cb1 100644
--- a/ui/jquery.ui.tabs.js
+++ b/ui/jquery.ui.tabs.js
@@ -792,11 +792,14 @@ if ( $.uiBackCompat !== false ) {
index = this._getIndex( index );
var options = this.options,
tab = this.lis.eq( index ).remove(),
- panel = this.panels.eq( index ).remove();
+ panel = this._getPanelForTab( tab.find( "a[aria-controls]" ) ).remove();
// If selected tab was removed focus tab to the right or
// in case the last tab was removed the tab to the left.
- if ( tab.hasClass( "ui-tabs-active" ) && this.anchors.length > 1) {
+ // We check for more than 2 tabs, because if there are only 2,
+ // then when we remove this tab, there will only be one tab left
+ // so we don't need to detect which tab to activate.
+ if ( tab.hasClass( "ui-tabs-active" ) && this.anchors.length > 2 ) {
this._activate( index + ( index + 1 < this.anchors.length ? 1 : -1 ) );
}