Skip to content

Commit

Permalink
fix: DataMenu keeps scrolling in view after app is out of view
Browse files Browse the repository at this point in the history
  • Loading branch information
mariobuikhuizen committed Jan 16, 2025
1 parent 87016c7 commit 08f8634
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions jdaviz/configs/default/plugins/data_menu/data_menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@
}
element = element.parentElement;
}
this.jupyterLabCell = this.$el.closest(".jp-Notebook-cell");
},
beforeDestroy() {
let element = document.getElementById(`dm-target-${this.viewer_id}`).parentElement
Expand Down Expand Up @@ -325,6 +326,11 @@
if (this.data_menu_open && document.getElementById(`dm-target-${this.viewer_id}`)) {
const menuContent = document.getElementById(`dm-content-${this.viewer_id}`);
menuContent.parentElement.style.top = top + "px";
/* since Jupyter Lab 4.2 cells outside the view port get a height of 0, causing the menu to be visible when
* that happens. This workaround hides the menu when it's parent cell is not in the viewport. */
const labCellHidden = this.jupyterLabCell && window.getComputedStyle(this.jupyterLabCell).height === "0px";
menuContent.parentElement.style.display = labCellHidden ? "none" : "";
}
},
boolToString(b) {
Expand Down

0 comments on commit 08f8634

Please sign in to comment.