jupyter-widgets / ipydatagrid

Fast Datagrid widget for the Jupyter Notebook and JupyterLab
BSD 3-Clause "New" or "Revised" License
579 stars 51 forks source link

Fix context menu position on Voila, NbClassic and Notebook<7 #509

Closed ianthomas23 closed 7 months ago

ianthomas23 commented 7 months ago

Fixes issue #422.

The positioning of context menus using Voila, NbClassic and Notebook<7 is incorrect as they are added to the DOM as the last child of the body and so the reference element that they are positioned with respect to is not necessarily correct, although it is fine for Jupyter Lab (the most tested option). The solution is make them the first child of the body instead.

Longer term there will be an addition to lumino so that menus can be attached to the correct node straight away rather than this approach of having to detach and reattach them. This code can remain then as the menu will already be the body's first child at the point of testing so the detach and reattach will be avoided.

Screenshots of this PR working in the presence of scrolling for lab, voila, notebook 6, notebook 7 and nbclassic respectively:

lab voila notebook6 notebook7 nbclassic
martinRenou commented 7 months ago

Fix #422 and fix https://github.com/voila-dashboards/voila/issues/930