mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-20 15:56:35 +00:00
Hopefully fix some back button issues (#8708)
This commit is contained in:
parent
742028b691
commit
7f7d89c745
@ -36,11 +36,11 @@ class DialogBox extends LitElement {
|
||||
|
||||
public closeDialog(): boolean {
|
||||
if (this._params?.confirmation || this._params?.prompt) {
|
||||
this._dismiss();
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
if (this._params) {
|
||||
return false;
|
||||
this._dismiss();
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -140,7 +140,7 @@ class DialogBox extends LitElement {
|
||||
}
|
||||
|
||||
private _dialogClosed(ev) {
|
||||
if (this._params?.prompt && ev.detail.action === "ignore") {
|
||||
if (ev.detail.action === "ignore") {
|
||||
return;
|
||||
}
|
||||
this._dismiss();
|
||||
|
@ -186,7 +186,7 @@ class HassTabsSubpage extends LitElement {
|
||||
}
|
||||
|
||||
private _tabTapped(ev: Event): void {
|
||||
navigate(this, (ev.currentTarget as any).path, true);
|
||||
navigate(this, (ev.currentTarget as any).path);
|
||||
}
|
||||
|
||||
private _backTapped(): void {
|
||||
@ -230,7 +230,6 @@ class HassTabsSubpage extends LitElement {
|
||||
padding: 0 16px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#tabbar {
|
||||
display: flex;
|
||||
font-size: 14px;
|
||||
|
@ -40,6 +40,12 @@ export const urlSyncMixin = <
|
||||
) => {
|
||||
if (DEBUG) {
|
||||
console.log("dialog closed", ev.detail.dialog);
|
||||
console.log(
|
||||
"open",
|
||||
history.state?.open,
|
||||
"dialog",
|
||||
history.state?.dialog
|
||||
);
|
||||
}
|
||||
// If not closed by navigating back, and not a new dialog is open, remove the open state from history
|
||||
if (
|
||||
@ -56,8 +62,11 @@ export const urlSyncMixin = <
|
||||
|
||||
private _popstateChangeListener = (ev: PopStateEvent) => {
|
||||
if (this._ignoreNextPopState) {
|
||||
if (ev.state?.oldState?.replaced) {
|
||||
// if the previous dialog was replaced, and the current dialog is closed, we should also remove the replaced dialog from history
|
||||
if (
|
||||
ev.state?.oldState?.replaced ||
|
||||
ev.state?.oldState?.dialogParams === null
|
||||
) {
|
||||
// if the previous dialog was replaced, or we could not copy the params, and the current dialog is closed, we should also remove the previous dialog from history
|
||||
if (DEBUG) {
|
||||
console.log("remove old state", ev.state.oldState);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user