use first composePath target

This commit is contained in:
Jan-Philipp Benecke 2024-12-06 12:44:53 +01:00 committed by Bram Kragten
parent 96b9d25bc5
commit 70532ac3bf

View File

@ -9,11 +9,7 @@ export const PreventUnsavedMixin = <T extends Constructor<LitElement>>(
class extends superClass {
private _handleClick = async (e: MouseEvent) => {
// get the right target, otherwise the composedPath would return <home-assistant> in the new event
const target = e
.composedPath()
.find(
(n) => (n as HTMLElement).tagName === "HA-SVG-ICON"
) as HTMLAnchorElement;
const target = e.composedPath()[0];
if (!isNavigationClick(e)) {
return;
}