Skip to content

Commit 6f90b03

Browse files
committed
fix: don't show boxes on non-existant elements
1 parent 7820b94 commit 6f90b03

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/LiveDevelopment/BrowserScripts/RemoteFunctions.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,14 @@ function RemoteFunctions(config) {
656656
return;
657657
}
658658

659+
// this check because when there is no element on the visible viewport, we don't want to show the box
660+
// for ex: when user clicks on a 'x' button and the button is responsible to hide a panel
661+
// then clicking on that button shouldn't show the more options box
662+
const elemBounds = this.element.getBoundingClientRect();
663+
if(elemBounds.height === 0 && elemBounds.width === 0) {
664+
return;
665+
}
666+
659667
this._style(); // style the box
660668

661669
window.document.body.appendChild(this.body);
@@ -860,6 +868,14 @@ function RemoteFunctions(config) {
860868
return;
861869
}
862870

871+
// this check because when there is no element on the visible viewport, we don't want to show the box
872+
// for ex: when user clicks on a 'x' button and the button is responsible to hide a panel
873+
// then clicking on that button shouldn't show the more options box
874+
const elemBounds = this.element.getBoundingClientRect();
875+
if(elemBounds.height === 0 && elemBounds.width === 0) {
876+
return;
877+
}
878+
863879
this._style(); // style the box
864880

865881
window.document.body.appendChild(this.body);

0 commit comments

Comments
 (0)