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:
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 thebody
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: