Permalink
Browse files

g-selector: now sends an activate event which is fired whenever an it…

…em is activated (can occur when the currently selected item is activated). The select event is fired only when the selected item changes.

g-menu-button: the menu now closes in response to the selector's activate event.
  • Loading branch information...
sorvell committed Jan 25, 2013
1 parent 0075c4c commit 5aaddd82d89796b493726d31fb5ab2d73a7e1770
Showing with 6 additions and 2 deletions.
  1. +4 −1 src/g-menu-button.html
  2. +2 −1 src/g-selector.html
View
@@ -13,7 +13,7 @@
<g-overlay id="overlay" class="slideup" opened="{{opened}}" modal>
<div class="arrow-border"></div>
<div class="arrow"></div>
- <g-menu id="menu" selected="{{selected}}" on-click="toggle">
+ <g-menu id="menu" selected="{{selected}}" on-activate="toggle">
<content select="*"></content>
</g-menu>
</g-overlay>
@@ -29,6 +29,9 @@
//* Returns the selected item.
get selection() {
return this.$.menu.selection;
+ },
+ activateHandler: function() {
+ this.opened = false;
}
}
});
View
@@ -51,7 +51,8 @@
var items = this.items;
var i = this.findDistributedTarget(inEvent.target, items);
if (i >= 0) {
- this.selected = this.valueForNode(items[i]) || i;
+ this.selected = this.valueForNode(items[i]) || i;
+ this.asend('activate');
}
}
});

0 comments on commit 5aaddd8

Please sign in to comment.