Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Tabs: Update manipulation demo - implement alt+del shortcut to remove…

… active tab. Fixes #7847 - Tabs: simple manipulation accessibility
  • Loading branch information...
commit e3ab5f811a97c9fd79038c550aa86dcff0465d40 1 parent 55ebc95
@jzaefferer jzaefferer authored
Showing with 10 additions and 2 deletions.
  1. +10 −2 demos/tabs/manipulation.html
View
12 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>
Please sign in to comment.
Something went wrong with that request. Please try again.