Skip to content

Commit

Permalink
chore: prevents unwanted click events firing
Browse files Browse the repository at this point in the history
Signed-off-by: John Cowen <john.cowen@konghq.com>
  • Loading branch information
johncowen committed Oct 9, 2024
1 parent d3a8553 commit 2264a02
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ function getRowAttributes(row: Row): Record<string, string> {
return attributes
}
const click = (e: MouseEvent) => {
const $tr = (e.target as HTMLElement).closest('tr')
if ($tr) {
Expand All @@ -129,7 +128,8 @@ const click = (e: MouseEvent) => {
}
return prev
}, null)
if ($a !== null && $a.closest('tr, li') === $tr) {
if ((window.getSelection()?.isCollapsed ?? true) && $a !== null && $a.closest('tr, li') === $tr) {
e.preventDefault()
$a.click()
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/common/SummaryView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ onClickOutside(
slideOutRef,
useThrottleFn((event: PointerEvent) => {
const $el = event.target as HTMLElement
if (event.isTrusted && $el.nodeName.toLowerCase() !== 'a') {
if ((window.getSelection()?.isCollapsed ?? true) && !event.defaultPrevented && event.isTrusted && $el.nodeName.toLowerCase() !== 'a') {
emit('close')
}
}, 1, true, false),
Expand Down

0 comments on commit 2264a02

Please sign in to comment.