mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-21 16:26:43 +00:00
use first composePath target
This commit is contained in:
parent
96b9d25bc5
commit
70532ac3bf
@ -9,11 +9,7 @@ export const PreventUnsavedMixin = <T extends Constructor<LitElement>>(
|
|||||||
class extends superClass {
|
class extends superClass {
|
||||||
private _handleClick = async (e: MouseEvent) => {
|
private _handleClick = async (e: MouseEvent) => {
|
||||||
// get the right target, otherwise the composedPath would return <home-assistant> in the new event
|
// get the right target, otherwise the composedPath would return <home-assistant> in the new event
|
||||||
const target = e
|
const target = e.composedPath()[0];
|
||||||
.composedPath()
|
|
||||||
.find(
|
|
||||||
(n) => (n as HTMLElement).tagName === "HA-SVG-ICON"
|
|
||||||
) as HTMLAnchorElement;
|
|
||||||
if (!isNavigationClick(e)) {
|
if (!isNavigationClick(e)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user