Browse files

Added shortcuts based on ARIA Best Pratices Guide:

Home / End keys and Ctrl + Up to move focus from within panel
to header.
  • Loading branch information...
1 parent 6e68c28 commit d6a1aa0da582203ae47ddb68720c99cb84f12482 @hanshillen committed Mar 23, 2012
Showing with 20 additions and 0 deletions.
  1. +20 −0 ui/jquery.ui.accordion.js
View
20 ui/jquery.ui.accordion.js
@@ -233,6 +233,12 @@ $.widget( "ui.accordion", {
case keyCode.SPACE:
case keyCode.ENTER:
this._eventHandler( event );
+ case keyCode.HOME:
+ toFocus = this.headers[ 0 ];
+ break;
+ case keyCode.END:
+ toFocus = this.headers[ length - 1 ];
+ break;
}
if ( toFocus ) {
@@ -243,6 +249,17 @@ $.widget( "ui.accordion", {
}
},
+ _panelKeyDown : function( event ) {
+ var keyCode = $.ui.keyCode;
+ switch ( event.keyCode ) {
+ case keyCode.UP:
+ if ( event.ctrlKey ) {
+ $( event.currentTarget ).prev().focus();
+ }
+ break;
+ }
+ },
+
refresh: function() {
var heightStyle = this.options.heightStyle,
parent = this.element.parent(),
@@ -330,6 +347,9 @@ $.widget( "ui.accordion", {
});
}
this._bind( this.headers, events );
+ this._bind( this.headers.next(), {
+ keydown : "_panelKeyDown"
+ } );
},
_eventHandler: function( event ) {

0 comments on commit d6a1aa0

Please sign in to comment.