Skip to content

Commit

Permalink
feat(UI): Close submenu or context menu on option click (#8193)
Browse files Browse the repository at this point in the history
Close #8192
  • Loading branch information
avelad authored Mar 3, 2025
1 parent be12a7f commit 5fc0fec
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 0 additions & 2 deletions ui/ad_statistics_button.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,6 @@ shaka.ui.AdStatisticsButton = class extends shaka.ui.Element {

/** @private */
onClick_() {
shaka.ui.Utils.setDisplay(this.parent, false);

if (this.container_.classList.contains('shaka-hidden')) {
this.icon_.textContent =
shaka.ui.Enums.MaterialDesignIcons.STATISTICS_OFF;
Expand Down
4 changes: 4 additions & 0 deletions ui/context_menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ shaka.ui.ContextMenu = class extends shaka.ui.Element {
shaka.ui.Utils.setDisplay(this.contextMenu_, false);
});

this.eventManager.listen(this.contextMenu_, 'click', () => {
shaka.ui.Utils.setDisplay(this.contextMenu_, false);
});

this.createChildren_();
}

Expand Down
3 changes: 2 additions & 1 deletion ui/settings_menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ shaka.ui.SettingsMenu = class extends shaka.ui.Element {
this.backButton.firstChild.textContent =
shaka.ui.Enums.MaterialDesignIcons.BACK;

this.eventManager.listen(this.backButton, 'click', () => {
this.eventManager.listen(this.menu, 'click', () => {
shaka.ui.Utils.setDisplay(this.menu, false);
shaka.ui.Utils.setDisplay(this.parent, true);

const isDisplayed =
Expand Down
2 changes: 0 additions & 2 deletions ui/statistics_button.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,6 @@ shaka.ui.StatisticsButton = class extends shaka.ui.Element {

/** @private */
onClick_() {
shaka.ui.Utils.setDisplay(this.parent, false);

if (this.container_.classList.contains('shaka-hidden')) {
this.icon_.textContent =
shaka.ui.Enums.MaterialDesignIcons.STATISTICS_OFF;
Expand Down

0 comments on commit 5fc0fec

Please sign in to comment.