diff options
author | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2012-12-28 10:15:38 +0100 |
---|---|---|
committer | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2012-12-28 17:24:24 +0100 |
commit | e3ab5f811a97c9fd79038c550aa86dcff0465d40 (patch) | |
tree | 154f9450626029af8750902477731badf2be173b | |
parent | 55ebc958793e5a3e5c6ce7e232aa502b320d23ca (diff) | |
download | jquery-ui-e3ab5f811a97c9fd79038c550aa86dcff0465d40.tar.gz jquery-ui-e3ab5f811a97c9fd79038c550aa86dcff0465d40.zip |
Tabs: Update manipulation demo - implement alt+del shortcut to remove active tab. Fixes #7847 - Tabs: simple manipulation accessibility
-rw-r--r-- | demos/tabs/manipulation.html | 12 |
1 files 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 = "<li><a href='#{href}'>#{label}</a> <span class='ui-icon ui-icon-close'>Remove Tab</span></li>", + tabTemplate = "<li><a href='#{href}'>#{label}</a> <span class='ui-icon ui-icon-close' role='presentation'>Remove Tab</span></li>", 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" ); + } + }); }); </script> </head> @@ -100,7 +108,7 @@ <div id="tabs"> <ul> - <li><a href="#tabs-1">Nunc tincidunt</a> <span class="ui-icon ui-icon-close">Remove Tab</span></li> + <li><a href="#tabs-1">Nunc tincidunt</a> <span class="ui-icon ui-icon-close" role="presentation">Remove Tab</span></li> </ul> <div id="tabs-1"> <p>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.</p> |