From edb0aaf6b4fbaed298f81778ced68990ab4f5b9a Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 2 Aug 2021 19:25:10 -0400 Subject: Improve audio auto play cancellation (#1873) * Cancel automatic audio playback when hiding the popup * Don't play audio if the popup is hidden --- ext/js/app/popup.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'ext/js/app') diff --git a/ext/js/app/popup.js b/ext/js/app/popup.js index 63657dd3..8bf1d7c9 100644 --- a/ext/js/app/popup.js +++ b/ext/js/app/popup.js @@ -38,6 +38,7 @@ class Popup extends EventDispatcher { this._injectPromise = null; this._injectPromiseComplete = false; this._visible = new DynamicProperty(false); + this._visibleValue = false; this._options = null; this._optionsContext = null; this._contentScale = 1.0; @@ -441,7 +442,10 @@ class Popup extends EventDispatcher { } _onVisibleChange({value}) { + if (this._visibleValue === value) { return; } + this._visibleValue = value; this._frame.style.setProperty('visibility', value ? 'visible' : 'hidden', 'important'); + this._invokeSafe('visibilityChanged', {value}); } _focusParent() { -- cgit v1.2.3