aboutsummaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2016-10-12 12:21:01 -0400
committerScott González <scott.gonzalez@gmail.com>2016-10-12 13:14:28 -0400
commitf1fa076f62e99089257f6f8159cb2ce503f0abc2 (patch)
tree911acee1e485bd09b21dfadc5630d79aee500b12 /demos
parent0627eb3645009d868ae20a27d0a283acd5797a1f (diff)
downloadjquery-ui-f1fa076f62e99089257f6f8159cb2ce503f0abc2.tar.gz
jquery-ui-f1fa076f62e99089257f6f8159cb2ce503f0abc2.zip
Tabs: Don't blur focused tab on sort
Fixes #14627 Closes gh-1761
Diffstat (limited to 'demos')
-rw-r--r--demos/tabs/sortable.html13
1 files changed, 12 insertions, 1 deletions
diff --git a/demos/tabs/sortable.html b/demos/tabs/sortable.html
index 051663ed4..9888cff77 100644
--- a/demos/tabs/sortable.html
+++ b/demos/tabs/sortable.html
@@ -9,10 +9,21 @@
<script src="../../external/requirejs/require.js"></script>
<script src="../bootstrap.js" data-modules="sortable">
var tabs = $( "#tabs" ).tabs();
+ var previouslyFocused = false;
+
tabs.find( ".ui-tabs-nav" ).sortable({
axis: "x",
- stop: function() {
+
+ // Sortable removes focus, so we need to restore it if the tab was focused
+ // prior to sorting
+ start: function(event, ui) {
+ previouslyFocused = document.activeElement === ui.item[ 0 ];
+ },
+ stop: function(event, ui) {
tabs.tabs( "refresh" );
+ if (previouslyFocused) {
+ ui.item.focus();
+ }
}
});
</script>