Fixed FeatherGridContextMenu placement in jupyter notebook and voila #441
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.
Issue number of the reported bug or feature request: #422
Describe your changes
Added a section of code that repositions the FeatherGridContextMenu widget to the actual click location, using the geometry of the page and document body. This fixes the bug in #422 (and also the original bug, documented in voila-dashboards/voila#930), which is caused by changes in Lumino originally proposed in jupyterlab/lumino#329 (comment), along with the retention of absolute positioning for this element in ipydatagrid.
Testing performed
Tested in two different notebooks (one bare-bones/MWE and one full-featured from a production setting) in jupyter notebook and voila (see attached image for example from barebones notebook). If page content changes immediately as a result of opening the filter dialog (such as an output widget getting cleared), this will cause the context menu to appear out of position. This could potentially be remedied by repositioning the menu a second time after the menu is fully opened, but this is likely to be excessive and not a good solution to that particular problem.
In the future, a departure from absolute positioning may be required, which may obviate the need for a repositioning operation here.