Skip to content

Commit

Permalink
use first composePath target
Browse files Browse the repository at this point in the history
  • Loading branch information
jpbede committed Dec 6, 2024
1 parent 5a12e11 commit 59bb2e9
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/mixins/prevent-unsaved-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 59bb2e9

Please sign in to comment.