Skip to content

Commit a72efa2

Browse files
authored
fix(replay): Ignore clicks with shift pressed (#8648)
Apparently click+shift also opens a link in a new tab (and focuses the tab immediately), so we also need to ignore such clicks for slow click detection. Closes getsentry/team-replay#128
1 parent 1279e76 commit a72efa2

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

packages/replay/src/coreHandlers/handleDom.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,16 @@ export const handleDomListener: (replay: ReplayContainer) => (handlerData: DomHa
2727

2828
const isClick = handlerData.name === 'click';
2929
const event = isClick && (handlerData.event as PointerEvent);
30-
// Ignore clicks if ctrl/alt/meta keys are held down as they alter behavior of clicks (e.g. open in new tab)
31-
if (isClick && replay.clickDetector && event && !event.altKey && !event.metaKey && !event.ctrlKey) {
30+
// Ignore clicks if ctrl/alt/meta/shift keys are held down as they alter behavior of clicks (e.g. open in new tab)
31+
if (
32+
isClick &&
33+
replay.clickDetector &&
34+
event &&
35+
!event.altKey &&
36+
!event.metaKey &&
37+
!event.ctrlKey &&
38+
!event.shiftKey
39+
) {
3240
handleClick(
3341
replay.clickDetector,
3442
result as Breadcrumb & { timestamp: number; data: { nodeId: number } },

0 commit comments

Comments
 (0)