Fix context menu position on Voila, NbClassic and Notebook<7 #509
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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: