BlockNote
BlockNote copied to clipboard
fix: Suggestion menu overflow issue
Summary
This PR fixes an issue when on initial show, the suggestion menu would not correctly flip vertically if there was no space, and would only flip once the items updated.
This would happen because the GenericPopover responsible for positioning and sizing the suggestion menu would do so based on its initial size. However, the menu fetches and renders its items async, so its initial size is far smaller than when it has all of its items.
To fix this, the GenericPopover's position is re-calculated when the suggestion menu items are updated.
Rationale
The suggestion menu issue is pretty annoying for users and causes bad UX.
Changes
- Added
GenericPopoverContextwhich holds the return values for FloatingUI hooks in theGenericPopover. - Made
SuggestionMenuWrapperupdate ancestorGenericPopoverposition when after items are updated. - Changed
autoPlacementmiddleware toflip(functions same as before, butautoPlacementwas inconsistent after this change).
Impact
N/A
Testing
N/A
Screenshots/Video
N/A
Checklist
- [X] Code follows the project's coding standards.
- [X] Unit tests covering the new feature have been added.
- [X] All existing tests pass.
- [X] The documentation has been updated to reflect the new feature