summaryrefslogtreecommitdiff
path: root/ext/bg/js/settings2/settings-display-controller.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-01-19 20:52:57 -0500
committerGitHub <noreply@github.com>2021-01-19 20:52:57 -0500
commitccf28ed055f08d38d28b19025d10cb4e7424464b (patch)
tree32c40a92149415c54ffd51b7868ae24d468cbaaa /ext/bg/js/settings2/settings-display-controller.js
parent3c51bf2a0be7c35f86d2da8c381453b95e6414bf (diff)
Menu refactor (#1277)
* Rename menuOpened event to menuOpen * Rename menuClosed event to menuClose * Rename close event * Assign _isClosed * Reuse event detail * Expose PopupMenu.openMenus * Rename and expose properties * Add cancelable argument to close * Update menuOpen detail * Update menuClose detail
Diffstat (limited to 'ext/bg/js/settings2/settings-display-controller.js')
-rw-r--r--ext/bg/js/settings2/settings-display-controller.js14
1 files changed, 1 insertions, 13 deletions
diff --git a/ext/bg/js/settings2/settings-display-controller.js b/ext/bg/js/settings2/settings-display-controller.js
index c5661b13..6f0a8276 100644
--- a/ext/bg/js/settings2/settings-display-controller.js
+++ b/ext/bg/js/settings2/settings-display-controller.js
@@ -26,7 +26,6 @@ class SettingsDisplayController {
this._modalController = modalController;
this._contentNode = null;
this._menuContainer = null;
- this._openPopupMenus = new Set();
this._onMoreToggleClickBind = null;
this._onMenuButtonClickBind = null;
}
@@ -198,11 +197,6 @@ class SettingsDisplayController {
return false;
}
- _onClosePopupMenu({popupMenu, onClose}) {
- this._openPopupMenus.delete(popupMenu);
- popupMenu.off('closed', onClose);
- }
-
_onInputTabActionKeyDown(e) {
if (e.key !== 'Tab' || e.ctrlKey) { return; }
@@ -248,7 +242,7 @@ class SettingsDisplayController {
}
_closeTopMenuOrModal() {
- for (const popupMenu of this._openPopupMenus) {
+ for (const popupMenu of PopupMenu.openMenus) {
popupMenu.close();
return;
}
@@ -266,12 +260,6 @@ class SettingsDisplayController {
this._menuContainer.appendChild(menu);
const popupMenu = new PopupMenu(element, menu);
- this._openPopupMenus.add(popupMenu);
-
- const data = {popupMenu, onClose: null};
- data.onClose = this._onClosePopupMenu.bind(this, data);
-
- popupMenu.on('closed', data.onClose);
popupMenu.prepare();
}