From e3ab5f811a97c9fd79038c550aa86dcff0465d40 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=B6rn=20Zaefferer?= Date: Fri, 28 Dec 2012 10:15:38 +0100 Subject: [PATCH] Tabs: Update manipulation demo - implement alt+del shortcut to remove active tab. Fixes #7847 - Tabs: simple manipulation accessibility --- demos/tabs/manipulation.html | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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.

    -- 2.39.5