fix: no more scrolling to top when opening AI menu#2503
Merged
nperez0111 merged 4 commits intomainfrom Feb 23, 2026
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
@blocknote/ariakit
@blocknote/code-block
@blocknote/core
@blocknote/mantine
@blocknote/react
@blocknote/server-util
@blocknote/shadcn
@blocknote/xl-ai
@blocknote/xl-docx-exporter
@blocknote/xl-email-exporter
@blocknote/xl-multi-column
@blocknote/xl-odt-exporter
@blocknote/xl-pdf-exporter
commit: |
nperez0111
reviewed
Feb 20, 2026
| }), | ||
| // we use the focus manager instead of `autoFocus={true}` to prevent "page-scrolls-to-top-when-opening-the-floating-element" | ||
| // see https://floating-ui.com/docs/floatingfocusmanager#page-scrolls-to-top-when-opening-the-floating-element | ||
| focusManagerProps: {}, |
Contributor
There was a problem hiding this comment.
This is sort of a smell no? This is equivalent to enabling it, but it doesn't feel right.
Shouldn't we always render the focus manager and just toggle the disabled prop?
Collaborator
Author
There was a problem hiding this comment.
I agree, I improved this in latest commit:
- was a bit cumbersome as now I make sure it's disabled by default on all call sites
- good news is that I was able to fix a bug so that FloatingComposer (for comments) now also autofocuses correctly
- side note; do you know if
TableCellPopovercan be removed? it's not used anywhere afaik
Contributor
There was a problem hiding this comment.
At first I was confused why you needed this, but then it made sense that you needed to pass through these props. I think this is fine for now, and is explicit.
We don't need TableCellPopover, I think it stayed from the refactor. I removed it
nperez0111
approved these changes
Feb 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
closes #2446
Summary
Fix page scrolling to the top when opening the AI menu.
Rationale
When opening the AI menu, the page's vertical scroll position would jump to the top. This happened because focusing the input element inside the floating popover triggers the browser's native scroll-into-view behavior before the element is properly positioned. By wrapping the popover content in floating-ui's
FloatingFocusManager(viafocusManagerProps: {}), focus is managed without causing the scroll jump (floating-ui docs).Changes
focusManagerPropsoption toFloatingUIOptionsandGenericPopoverto optionally wrap popover content in aFloatingFocusManagerfocusManagerProps: {}inAIMenuControllerto use managed focus instead of nativeautoFocusImpact
No breaking changes. Only affects the AI menu's focus behavior when opening.
Testing
scrollYhasn't jumped to 0Screenshots/Video
x
Checklist
Additional Notes
N/A