Skip to content

Commit d7108d3

Browse files
committed
check all of composedPath
1 parent 52e6385 commit d7108d3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/uui-base/lib/mixins/SelectableMixin.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,13 @@ export const SelectableMixin = <T extends Constructor<LitElement>>(
9595

9696
readonly #onClick = (e: Event) => {
9797
const composePath = e.composedPath();
98-
const target = composePath[0] as HTMLElement;
98+
const isAnchorTag = composePath.some(el => {
99+
const element = el as HTMLElement;
100+
return element.tagName === 'A';
101+
});
99102

100-
if (target.tagName === 'A') return;
103+
// never select when clicking on a link
104+
if (isAnchorTag) return;
101105

102106
const isSelectable =
103107
this._selectable || (this.deselectable && this.selected);

0 commit comments

Comments
 (0)