mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
refactored keyboard handling to a switch statement for clarity.
This commit is contained in:
parent
976b9b57bb
commit
ed4f58c6d3
@ -106,18 +106,18 @@ $.widget("ui.accordion", {
|
|||||||
var currentIndex = this.options.headers.index(e.target);
|
var currentIndex = this.options.headers.index(e.target);
|
||||||
var toFocus = false;
|
var toFocus = false;
|
||||||
|
|
||||||
if (e.keyCode == keyCode.RIGHT || e.keyCode == keyCode.DOWN){
|
switch(e.keyCode) {
|
||||||
|
case keyCode.RIGHT:
|
||||||
|
case keyCode.DOWN:
|
||||||
toFocus = this.options.headers[(currentIndex + 1) % length];
|
toFocus = this.options.headers[(currentIndex + 1) % length];
|
||||||
|
break;
|
||||||
} else if (e.keyCode == keyCode.LEFT || e.keyCode == keyCode.UP) {
|
case keyCode.LEFT:
|
||||||
|
case keyCode.UP:
|
||||||
toFocus = this.options.headers[(currentIndex - 1 + length) % length];
|
toFocus = this.options.headers[(currentIndex - 1 + length) % length];
|
||||||
|
break;
|
||||||
} else if (e.keyCode == keyCode.SPACE || e.keyCode == keyCode.ENTER) {
|
case keyCode.SPACE:
|
||||||
|
case keyCode.ENTER:
|
||||||
return clickHandler.call(this.element[0], { target: e.target });
|
return clickHandler.call(this.element[0], { target: e.target });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toFocus) {
|
if (toFocus) {
|
||||||
|
Loading…
Reference in New Issue
Block a user