add trigger focus option to replayer, which may helps integration into other apps

This commit is contained in:
Yanzhen Yu
2026-04-01 12:00:00 +08:00
parent 9035a8f814
commit 329c790194
2 changed files with 4 additions and 1 deletions

View File

@@ -74,6 +74,7 @@ export class Replayer {
blockClass: 'rr-block',
liveMode: false,
insertStyleRules: [],
triggerFocus: true,
};
this.config = Object.assign({}, defaultConfig, config);
@@ -494,6 +495,7 @@ export class Replayer {
type: d.type,
target,
});
const { triggerFocus } = this.config;
switch (d.type) {
case MouseInteractions.Blur:
if (((target as Node) as HTMLElement).blur) {
@@ -501,7 +503,7 @@ export class Replayer {
}
break;
case MouseInteractions.Focus:
if (((target as Node) as HTMLElement).focus) {
if (triggerFocus && ((target as Node) as HTMLElement).focus) {
((target as Node) as HTMLElement).focus({
preventScroll: true,
});

View File

@@ -318,6 +318,7 @@ export type playerConfig = {
blockClass: string;
liveMode: boolean;
insertStyleRules: string[];
triggerFocus: boolean;
};
export type playerMetaData = {