Menubar: Handle ESCAPE to close and refactor document-click code to also use _bind

This commit is contained in:
jzaefferer 2011-03-17 12:00:37 +01:00
parent 0872aac982
commit 2e38e04535

View File

@ -75,8 +75,17 @@ $.widget("ui.menubar", {
};
});
$(document).click(function(event) {
self._bind(document, {
click: function(event) {
!$(event.target).closest(".ui-menubar").length && self._close();
}
})
self._bind({
keyup: function(event) {
if (event.keyCode == $.ui.keyCode.ESCAPE) {
self._close();
}
}
});
},