From: Jörn Zaefferer Date: Fri, 28 Dec 2012 09:15:38 +0000 (+0100) Subject: Tabs: Update manipulation demo - implement alt+del shortcut to remove active tab... X-Git-Tag: 1.10.0-rc.1~20 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F869%2Fhead;p=jquery-ui.git Tabs: Update manipulation demo - implement alt+del shortcut to remove active tab. Fixes #7847 - Tabs: simple manipulation accessibility --- diff --git a/demos/tabs/manipulation.html b/demos/tabs/manipulation.html index 9a66076e7..0e0af365a 100644 --- a/demos/tabs/manipulation.html +++ b/demos/tabs/manipulation.html @@ -24,7 +24,7 @@ $(function() { var tabTitle = $( "#tab_title" ), tabContent = $( "#tab_content" ), - tabTemplate = "
  • #{label} Remove Tab
  • ", + tabTemplate = "
  • #{label} Remove Tab
  • ", tabCounter = 2; var tabs = $( "#tabs" ).tabs(); @@ -80,6 +80,14 @@ $( "#" + panelId ).remove(); tabs.tabs( "refresh" ); }); + + tabs.bind( "keyup", function( event ) { + if ( event.altKey && event.keyCode === $.ui.keyCode.BACKSPACE ) { + var panelId = tabs.find( ".ui-tabs-active" ).remove().attr( "aria-controls" ); + $( "#" + panelId ).remove(); + tabs.tabs( "refresh" ); + } + }); }); @@ -100,7 +108,7 @@

    Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.