Commit 575fcb93 authored by Alex Danilo's avatar Alex Danilo Committed by Commit Bot

[menus] Make sure only one sub menu shows

Changes the logic that shows a sub menu to check if any other sub menu
is showing, and if so, hide it before showing the new sub menu.

Bug: 1100177
Change-Id: I33527c776bdff7cb0d7d9a452a0fe13b8df60434
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2277376Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Commit-Queue: Alex Danilo <adanilo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#784350}
parent 9bb098df
......@@ -293,6 +293,16 @@ cr.define('cr.ui', () => {
switch (e.type) {
case 'activate':
case 'mouseover':
// Hide any other sub menu being shown.
const showing = /** @type {cr.ui.MenuItem} */ (
this.querySelector('cr-menu-item[sub-menu-shown]'));
if (showing && showing !== item) {
showing.removeAttribute('sub-menu-shown');
const shownSubMenu = this.getSubMenuFromItem(showing);
if (shownSubMenu) {
shownSubMenu.hide();
}
}
item.setAttribute('sub-menu-shown', 'shown');
this.positionSubMenu_(item, subMenu);
subMenu.show();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment