Skip to content

Commit

Permalink
Popup: Make menu dependency actually optional, cleanup demos
Browse files Browse the repository at this point in the history
  • Loading branch information
jzaefferer committed Sep 21, 2011
1 parent a3866bf commit cb372b7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 27 deletions.
12 changes: 0 additions & 12 deletions demos/popup/animation.html
Expand Up @@ -9,7 +9,6 @@
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.position.js"></script>
<script src="../../ui/jquery.ui.button.js"></script>
<script src="../../ui/jquery.ui.menu.js"></script>
<script src="../../ui/jquery.effects.core.js"></script>
<script src="../../ui/jquery.effects.blind.js"></script>
<script src="../../ui/jquery.effects.scale.js"></script>
Expand Down Expand Up @@ -43,17 +42,6 @@
</script>
<style type="text/css">
.ui-popup { position: absolute; z-index: 5000; }
.ui-menu { width: 200px; }

/*
table {
border-collapse: collapse;
}
th, td {
padding: 0.5em;
border: 1px solid black;
}
*/

#login-form {
width: 16em; border: 1px solid gray; border-radius: 5px;
Expand Down
12 changes: 0 additions & 12 deletions demos/popup/default.html
Expand Up @@ -9,7 +9,6 @@
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.position.js"></script>
<script src="../../ui/jquery.ui.button.js"></script>
<script src="../../ui/jquery.ui.menu.js"></script>
<script src="../../ui/jquery.ui.popup.js"></script>
<script>
$(function() {
Expand All @@ -28,17 +27,6 @@
</script>
<style type="text/css">
.ui-popup { position: absolute; z-index: 5000; }
.ui-menu { width: 200px; }

/*
table {
border-collapse: collapse;
}
th, td {
padding: 0.5em;
border: 1px solid black;
}
*/

#login-form {
width: 16em; border: 1px solid gray; border-radius: 5px;
Expand Down
7 changes: 4 additions & 3 deletions ui/jquery.ui.popup.js
Expand Up @@ -88,8 +88,8 @@ $.widget( "ui.popup", {
}
});

if ( !this.element.is( ":ui-menu" ) ) {
//default use case, wrap tab order in popup
if ( !$.ui.menu || !this.element.is( ":ui-menu" ) ) {
// default use case, wrap tab order in popup
this._bind({ keydown : function( event ) {
if ( event.keyCode !== $.ui.keyCode.TAB ) {
return;
Expand Down Expand Up @@ -174,7 +174,8 @@ $.widget( "ui.popup", {
.attr( "aria-expanded", "true" )
.position( position );

if (this.element.is( ":ui-menu" )) { //popup is a menu
// can't use custom selector when menu isn't loaded
if ( $.ui.menu && this.element.is( ":ui-menu" ) ) {
this.element.menu( "focus", event, this.element.children( "li" ).first() );
this.element.focus();
} else {
Expand Down

0 comments on commit cb372b7

Please sign in to comment.