Skip to content

Commit

Permalink
ignore certain <a> clicks
Browse files Browse the repository at this point in the history
  • Loading branch information
mydea committed May 10, 2023
1 parent a9192a9 commit 1402cff
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/replay/src/coreHandlers/handleSlowClick.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,16 @@ function ignoreElement(node: HTMLElement, config: SlowClickConfig): boolean {
return true;
}

// If <a> tag, detect special variants that may not lead to an action
// If target !== _self, we may open the link somewhere else, which would lead to no action
// Also, when downloading a file, we may not leave the page, but still not trigger an action
if (
node.tagName === 'A' &&
(node.hasAttribute('download') || (node.hasAttribute('target') && node.getAttribute('target') !== '_self'))
) {
return true;
}

if (config.ignoreSelector && node.matches(config.ignoreSelector)) {
return true;
}
Expand Down

0 comments on commit 1402cff

Please sign in to comment.