There was an error while loading. Please reload this page.
1 parent 0627eb3 commit f1fa076Copy full SHA for f1fa076
demos/tabs/sortable.html
@@ -9,10 +9,21 @@
9
<script src="../../external/requirejs/require.js"></script>
10
<script src="../bootstrap.js" data-modules="sortable">
11
var tabs = $( "#tabs" ).tabs();
12
+ var previouslyFocused = false;
13
+
14
tabs.find( ".ui-tabs-nav" ).sortable({
15
axis: "x",
- stop: function() {
16
17
+ // Sortable removes focus, so we need to restore it if the tab was focused
18
+ // prior to sorting
19
+ start: function(event, ui) {
20
+ previouslyFocused = document.activeElement === ui.item[ 0 ];
21
+ },
22
+ stop: function(event, ui) {
23
tabs.tabs( "refresh" );
24
+ if (previouslyFocused) {
25
+ ui.item.focus();
26
+ }
27
}
28
});
29
</script>
0 commit comments