| Index: chrome/browser/resources/md_bookmarks/command_manager.js
|
| diff --git a/chrome/browser/resources/md_bookmarks/command_manager.js b/chrome/browser/resources/md_bookmarks/command_manager.js
|
| index 20c90a8353f4fdabd8113f8471125edd6371a15e..210cdffcc54ddf4c19a66c105e165145d7b0387a 100644
|
| --- a/chrome/browser/resources/md_bookmarks/command_manager.js
|
| +++ b/chrome/browser/resources/md_bookmarks/command_manager.js
|
| @@ -97,8 +97,11 @@ cr.define('bookmarks', function() {
|
| */
|
| openCommandMenuAtPosition: function(x, y, items) {
|
| this.menuIds_ = items || this.getState().selection.items;
|
| - /** @type {!CrActionMenuElement} */ (this.$.dropdown)
|
| - .showAtPosition({top: y, left: x});
|
| + var dropdown =
|
| + /** @type {!CrActionMenuElement} */ (this.$.dropdown.get());
|
| + // Ensure that the menu is fully rendered before trying to position it.
|
| + Polymer.dom.flush();
|
| + dropdown.showAtPosition({top: y, left: x});
|
| },
|
|
|
| /**
|
| @@ -108,12 +111,16 @@ cr.define('bookmarks', function() {
|
| */
|
| openCommandMenuAtElement: function(target) {
|
| this.menuIds_ = this.getState().selection.items;
|
| - /** @type {!CrActionMenuElement} */ (this.$.dropdown).showAt(target);
|
| + var dropdown =
|
| + /** @type {!CrActionMenuElement} */ (this.$.dropdown.get());
|
| + // Ensure that the menu is fully rendered before trying to position it.
|
| + Polymer.dom.flush();
|
| + dropdown.showAt(target);
|
| },
|
|
|
| closeCommandMenu: function() {
|
| this.menuIds_ = new Set();
|
| - /** @type {!CrActionMenuElement} */ (this.$.dropdown).close();
|
| + /** @type {!CrActionMenuElement} */ (this.$.dropdown.get()).close();
|
| },
|
|
|
| ////////////////////////////////////////////////////////////////////////////
|
| @@ -447,7 +454,7 @@ cr.define('bookmarks', function() {
|
| * @private
|
| */
|
| onMenuMousedown_: function(e) {
|
| - if (e.path[0] != this.$.dropdown)
|
| + if (e.path[0] != this.$.dropdown.getIfExists())
|
| return;
|
|
|
| this.closeCommandMenu();
|
|
|