Skip to content

Commit 3da07a7

Browse files
committed
cherry-pick(#36625): chore: render overlay on top of modal dom content
1 parent b01d0d1 commit 3da07a7

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

packages/injected/src/highlight.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export class Highlight {
6161
this._glassPaneElement.style.right = '0';
6262
this._glassPaneElement.style.bottom = '0';
6363
this._glassPaneElement.style.left = '0';
64-
this._glassPaneElement.style.zIndex = '2147483646';
64+
this._glassPaneElement.style.zIndex = '2147483647';
6565
this._glassPaneElement.style.pointerEvents = 'none';
6666
this._glassPaneElement.style.display = 'flex';
6767
this._glassPaneElement.style.backgroundColor = 'transparent';
@@ -90,7 +90,9 @@ export class Highlight {
9090

9191
install() {
9292
// NOTE: document.documentElement can be null: https://github.com/microsoft/TypeScript/issues/50078
93-
if (this._injectedScript.document.documentElement && !this._injectedScript.document.documentElement.contains(this._glassPaneElement))
93+
if (!this._injectedScript.document.documentElement)
94+
return;
95+
if (!this._injectedScript.document.documentElement.contains(this._glassPaneElement) || this._glassPaneElement.nextElementSibling)
9496
this._injectedScript.document.documentElement.appendChild(this._glassPaneElement);
9597
}
9698

packages/injected/src/recorder/recorder.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,11 @@ class RecordActionTool implements RecorderTool {
206206
return 'pointer';
207207
}
208208

209-
install() {
209+
private _installObserverIfNeeded() {
210+
if (this._observer)
211+
return;
212+
if (!this._recorder.injectedScript.document?.body)
213+
return;
210214
this._observer = new MutationObserver(mutations => {
211215
if (!this._hoveredElement)
212216
return;
@@ -601,6 +605,7 @@ class RecordActionTool implements RecorderTool {
601605
}
602606

603607
private _updateModelForHoveredElement() {
608+
this._installObserverIfNeeded();
604609
if (this._performingActions.size)
605610
return;
606611
if (!this._hoveredElement || !this._hoveredElement.isConnected) {

0 commit comments

Comments
 (0)