aboutsummaryrefslogtreecommitdiffstats
path: root/tests/visual/menu
diff options
context:
space:
mode:
authorjzaefferer <joern.zaefferer@gmail.com>2011-04-18 17:07:08 +0200
committerjzaefferer <joern.zaefferer@gmail.com>2011-04-18 17:07:08 +0200
commit5076f233dbbfc39f29f2be11a9549f262bb471ea (patch)
tree88bcb720ca85bf7d682268f71239e6d70c7958bb /tests/visual/menu
parent4547da1ba56641a490f03043241003aca505e3e4 (diff)
downloadjquery-ui-5076f233dbbfc39f29f2be11a9549f262bb471ea.tar.gz
jquery-ui-5076f233dbbfc39f29f2be11a9549f262bb471ea.zip
Close popup when blurred and make sure that shift-tab when popup is open
skips the trigger.
Diffstat (limited to 'tests/visual/menu')
-rw-r--r--tests/visual/menu/popup.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/visual/menu/popup.js b/tests/visual/menu/popup.js
index 2cd4ee047..f57cba699 100644
--- a/tests/visual/menu/popup.js
+++ b/tests/visual/menu/popup.js
@@ -35,7 +35,7 @@ $.widget( "ui.popup", {
this.element
.addClass("ui-popup")
this._close();
-
+
this._bind(this.options.trigger, {
click: function( event ) {
event.preventDefault();
@@ -46,6 +46,10 @@ $.widget( "ui.popup", {
}
});
+ this._bind(this.element, {
+ blur: "_close"
+ });
+
this._bind({
keyup: function( event ) {
if (event.keyCode == $.ui.keyCode.ESCAPE && this.element.is( ":visible" )) {
@@ -94,6 +98,10 @@ $.widget( "ui.popup", {
.attr( "aria-expanded", true )
.position( position )
.focus();
+
+ // take trigger out of tab order to allow shift-tab to skip trigger
+ this.options.trigger.attr("tabindex", -1);
+
this.open = true;
this._trigger( "open", event );
},
@@ -103,6 +111,9 @@ $.widget( "ui.popup", {
.hide()
.attr( "aria-hidden", true )
.attr( "aria-expanded", false );
+
+ this.options.trigger.attr("tabindex", 0);
+
this.open = false;
this._trigger( "close", event );
}