Skip to content

Commit

Permalink
fix: DataMenu keeps scrolling in view after app is out of view (space…
Browse files Browse the repository at this point in the history
…telescope#3391)

* fix: DataMenu keeps scrolling in view after app is out of view
  • Loading branch information
mariobuikhuizen authored Jan 16, 2025
1 parent 858f443 commit 3107b87
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ Bug Fixes

- Fixes traceback from the data-menu that can be caused by a viewer rename. [#3383]

- Fixes data-menu visibility when app is scrolled out of view. [#3391]

Cubeviz
^^^^^^^

Expand Down
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 3107b87

Please sign in to comment.