Skip to content

Commit 1402cff

Browse files
committed
ignore certain <a> clicks
1 parent a9192a9 commit 1402cff

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

packages/replay/src/coreHandlers/handleSlowClick.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,16 @@ function ignoreElement(node: HTMLElement, config: SlowClickConfig): boolean {
119119
return true;
120120
}
121121

122+
// If <a> tag, detect special variants that may not lead to an action
123+
// If target !== _self, we may open the link somewhere else, which would lead to no action
124+
// Also, when downloading a file, we may not leave the page, but still not trigger an action
125+
if (
126+
node.tagName === 'A' &&
127+
(node.hasAttribute('download') || (node.hasAttribute('target') && node.getAttribute('target') !== '_self'))
128+
) {
129+
return true;
130+
}
131+
122132
if (config.ignoreSelector && node.matches(config.ignoreSelector)) {
123133
return true;
124134
}

0 commit comments

Comments
 (0)