only add click animation when cast is not sync

This commit is contained in:
Yanzhen Yu
2026-04-01 12:00:00 +08:00
parent 781d6ebd10
commit 6f06b5e1e7

View File

@@ -366,26 +366,32 @@ export class Replayer {
} }
const event = new Event(MouseInteractions[d.type].toLowerCase()); const event = new Event(MouseInteractions[d.type].toLowerCase());
const target = (mirror.getNode(d.id) as Node) as HTMLElement; const target = (mirror.getNode(d.id) as Node) as HTMLElement;
if (d.type === MouseInteractions.Blur) { switch (d.type) {
target.blur(); case MouseInteractions.Blur:
} else if (d.type === MouseInteractions.Click) { target.blur();
/** break;
* Click has no visual impact when replaying and may case MouseInteractions.Focus:
* trigger navigation when apply to an <a> link. target.focus({
* So we will not call click(), instead we add an preventScroll: true,
* animation to the mouse element which indicate user });
* clicked at this moment. break;
*/ case MouseInteractions.Click:
this.mouse.classList.remove('active'); /**
// tslint:disable-next-line * Click has no visual impact when replaying and may
void this.mouse.offsetWidth; * trigger navigation when apply to an <a> link.
this.mouse.classList.add('active'); * So we will not call click(), instead we add an
} else if (d.type === MouseInteractions.Focus) { * animation to the mouse element which indicate user
target.focus({ * clicked at this moment.
preventScroll: true, */
}); if (!isSync) {
} else { this.mouse.classList.remove('active');
target.dispatchEvent(event); // tslint:disable-next-line
void this.mouse.offsetWidth;
this.mouse.classList.add('active');
}
break;
default:
target.dispatchEvent(event);
} }
break; break;
} }