Skip to content

Commit

Permalink
check all of composedPath
Browse files Browse the repository at this point in the history
  • Loading branch information
madsrasmussen committed Nov 27, 2024
1 parent 52e6385 commit d7108d3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/uui-base/lib/mixins/SelectableMixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,13 @@ export const SelectableMixin = <T extends Constructor<LitElement>>(

readonly #onClick = (e: Event) => {
const composePath = e.composedPath();
const target = composePath[0] as HTMLElement;
const isAnchorTag = composePath.some(el => {
const element = el as HTMLElement;
return element.tagName === 'A';
});

if (target.tagName === 'A') return;
// never select when clicking on a link
if (isAnchorTag) return;

const isSelectable =
this._selectable || (this.deselectable && this.selected);
Expand Down

0 comments on commit d7108d3

Please sign in to comment.