Skip to content
Permalink
Browse files

Close popup when blurred and make sure that shift-tab when popup is open

skips the trigger.
  • Loading branch information
jzaefferer committed Apr 18, 2011
1 parent 4547da1 commit 5076f233dbbfc39f29f2be11a9549f262bb471ea
Showing with 12 additions and 1 deletion.
  1. +12 −1 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 );
}

0 comments on commit 5076f23

Please sign in to comment.
You can’t perform that action at this time.