aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorjzaefferer <joern.zaefferer@gmail.com>2011-02-24 12:05:20 +0100
committerjzaefferer <joern.zaefferer@gmail.com>2011-02-24 12:05:20 +0100
commit38cfcfffe92f2ac2572ab7ebc51e860de9312baf (patch)
tree8c03b1d8881627a041c1d20f134351b300f970da /ui
parent5c687be331d3110ece3b2417c021485950f87ff9 (diff)
downloadjquery-ui-38cfcfffe92f2ac2572ab7ebc51e860de9312baf.tar.gz
jquery-ui-38cfcfffe92f2ac2572ab7ebc51e860de9312baf.zip
Menu: Update autocomplete to use deactivate and check for focus class
Diffstat (limited to 'ui')
-rw-r--r--ui/jquery.ui.autocomplete.js8
-rw-r--r--ui/jquery.ui.menu.js19
2 files changed, 22 insertions, 5 deletions
diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js
index 32959b3c5..c83f042c0 100644
--- a/ui/jquery.ui.autocomplete.js
+++ b/ui/jquery.ui.autocomplete.js
@@ -323,7 +323,7 @@ $.widget( "ui.autocomplete", {
clearTimeout( this.closing );
if ( this.menu.element.is(":visible") ) {
this.menu.element.hide();
- this.menu.deactivate();
+ this.menu.blur();
this._trigger( "close", event );
}
},
@@ -358,8 +358,8 @@ $.widget( "ui.autocomplete", {
.empty()
.zIndex( this.element.zIndex() + 1 );
this._renderMenu( ul, items );
- // TODO refresh should check if the active item is still in the dom, removing the need for a manual deactivate
- this.menu.deactivate();
+ // TODO refresh should check if the active item is still in the dom, removing the need for a manual blur
+ this.menu.blur();
this.menu.refresh();
// size and position menu
@@ -400,7 +400,7 @@ $.widget( "ui.autocomplete", {
if ( this.menu.first() && /^previous/.test(direction) ||
this.menu.last() && /^next/.test(direction) ) {
this._value( this.term );
- this.menu.deactivate();
+ this.menu.blur();
return;
}
this.menu[ direction ]( event );
diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js
index d7c0f5c74..cba42d17f 100644
--- a/ui/jquery.ui.menu.js
+++ b/ui/jquery.ui.menu.js
@@ -17,6 +17,12 @@ var idIncrement = 0;
$.widget("ui.menu", {
defaultElement: "<ul>",
+ options: {
+ position: {
+ my: "left top",
+ at: "right top"
+ }
+ },
_create: function() {
var self = this;
this.menuId = this.element.attr( "id" ) || "ui-menu-" + idIncrement++;
@@ -145,8 +151,19 @@ $.widget("ui.menu", {
},
refresh: function() {
+ // initialize nested menus
+ // TODO add role=listbox to these, too? or just the top level menu?
+ var submenus = this.element.find("ul:not(.ui-menu)")
+ .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
+ .hide()
+
+ submenus
+ .prev("a")
+ .prepend('<span class="ui-icon ui-icon-carat-1-e"></span>');
+
+
// don't refresh list items that are already adapted
- var items = this.element.children( "li:not(.ui-menu-item):has(a)" )
+ var items = submenus.add(this.element).children( "li:not(.ui-menu-item):has(a)" )
.addClass( "ui-menu-item" )
.attr( "role", "menuitem" );