Fix issue with menu closing too early on microphone unmute.
This commit is contained in:
+16
-12
@@ -180,10 +180,26 @@ export class FrigateCardMenu extends LitElement {
|
|||||||
if (menuToggle) {
|
if (menuToggle) {
|
||||||
this.expanded = !this.expanded;
|
this.expanded = !this.expanded;
|
||||||
} else if (tookAction) {
|
} else if (tookAction) {
|
||||||
|
// Don't close the menu if there is another action to come.
|
||||||
|
const holdAction = getActionConfigGivenAction('hold', config);
|
||||||
|
const doubleTapAction = getActionConfigGivenAction('double_tap', config);
|
||||||
|
const tapAction = getActionConfigGivenAction('tap', config);
|
||||||
|
const endTapAction = getActionConfigGivenAction('end_tap', config);
|
||||||
|
|
||||||
|
if (
|
||||||
|
interaction === 'end_tap' ||
|
||||||
|
(interaction === 'start_tap' &&
|
||||||
|
!holdAction &&
|
||||||
|
!doubleTapAction &&
|
||||||
|
!tapAction &&
|
||||||
|
!endTapAction) ||
|
||||||
|
(interaction !== 'end_tap' && !endTapAction)
|
||||||
|
) {
|
||||||
this.expanded = false;
|
this.expanded = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensure menu buttons are sorted before the render.
|
* Ensure menu buttons are sorted before the render.
|
||||||
@@ -222,11 +238,6 @@ export class FrigateCardMenu extends LitElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Render a button.
|
|
||||||
* @param button The button configuration to render.
|
|
||||||
* @returns A rendered template or void.
|
|
||||||
*/
|
|
||||||
protected _renderButton(button: MenuItem): TemplateResult | void {
|
protected _renderButton(button: MenuItem): TemplateResult | void {
|
||||||
if (button.type === 'custom:frigate-card-menu-submenu') {
|
if (button.type === 'custom:frigate-card-menu-submenu') {
|
||||||
return html` <frigate-card-submenu
|
return html` <frigate-card-submenu
|
||||||
@@ -292,10 +303,6 @@ export class FrigateCardMenu extends LitElement {
|
|||||||
</ha-icon-button>`;
|
</ha-icon-button>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Render the menu.
|
|
||||||
* @returns A rendered template or void.
|
|
||||||
*/
|
|
||||||
protected render(): TemplateResult | void {
|
protected render(): TemplateResult | void {
|
||||||
if (!this._menuConfig) {
|
if (!this._menuConfig) {
|
||||||
return;
|
return;
|
||||||
@@ -336,9 +343,6 @@ export class FrigateCardMenu extends LitElement {
|
|||||||
</div>`;
|
</div>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get styles.
|
|
||||||
*/
|
|
||||||
static get styles(): CSSResultGroup {
|
static get styles(): CSSResultGroup {
|
||||||
return unsafeCSS(menuStyle);
|
return unsafeCSS(menuStyle);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user