add trigger focus option to replayer, which may helps integration into other apps
This commit is contained in:
@@ -74,6 +74,7 @@ export class Replayer {
|
|||||||
blockClass: 'rr-block',
|
blockClass: 'rr-block',
|
||||||
liveMode: false,
|
liveMode: false,
|
||||||
insertStyleRules: [],
|
insertStyleRules: [],
|
||||||
|
triggerFocus: true,
|
||||||
};
|
};
|
||||||
this.config = Object.assign({}, defaultConfig, config);
|
this.config = Object.assign({}, defaultConfig, config);
|
||||||
|
|
||||||
@@ -494,6 +495,7 @@ export class Replayer {
|
|||||||
type: d.type,
|
type: d.type,
|
||||||
target,
|
target,
|
||||||
});
|
});
|
||||||
|
const { triggerFocus } = this.config;
|
||||||
switch (d.type) {
|
switch (d.type) {
|
||||||
case MouseInteractions.Blur:
|
case MouseInteractions.Blur:
|
||||||
if (((target as Node) as HTMLElement).blur) {
|
if (((target as Node) as HTMLElement).blur) {
|
||||||
@@ -501,7 +503,7 @@ export class Replayer {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MouseInteractions.Focus:
|
case MouseInteractions.Focus:
|
||||||
if (((target as Node) as HTMLElement).focus) {
|
if (triggerFocus && ((target as Node) as HTMLElement).focus) {
|
||||||
((target as Node) as HTMLElement).focus({
|
((target as Node) as HTMLElement).focus({
|
||||||
preventScroll: true,
|
preventScroll: true,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -318,6 +318,7 @@ export type playerConfig = {
|
|||||||
blockClass: string;
|
blockClass: string;
|
||||||
liveMode: boolean;
|
liveMode: boolean;
|
||||||
insertStyleRules: string[];
|
insertStyleRules: string[];
|
||||||
|
triggerFocus: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type playerMetaData = {
|
export type playerMetaData = {
|
||||||
|
|||||||
Reference in New Issue
Block a user