Repository navigation
feat(suggestion-menu): anchor to the host's text - #534
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
kianbazza
added this pull request to stack #526
September 29, 2026 01:44
kianbazza
force-pushed
the
ui-563-anchor-the-suggestion-menu-to-the-hosts-text
branch
from
September 29, 2026 14:29
be5c824 to
3c83451
Compare
kianbazza
marked this pull request as ready for review
September 29, 2026 14:45
This branch was successfully deployed
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.
Summary
SuggestionMenuanchors the popup to the host's text.anchor: () => DOMRect | null. The popup follows the text when the page or field scrolls. A new position is computed only when the measured rect changes.nullkeeps the last position, and nothing is measured on close, when the text may already be gone.SuggestionMenu.Positionerplaces the popup below, aligned to the start. If there's no room below it opens above, and it keeps that side until it closes, so it never flips while the user types or results stream in. It never goes beside the anchor, where it would cover the text.The side is read once Base UI has positioned against an anchor measured during this opening. In a background tab, where frames don't run, it's read on the first keystroke instead.
Evidence
suggestion-menu.anchor.test.tsx(24 tests) gives the viewport a real size in jsdom:Checked in Chromium with ProseMirror at 900×290: the popup opened above, stayed above after the list shrank to one row, and moved with the text when the page scrolled.
Merge Danger
Door: two-way
Blast Radius: SuggestionMenu only
Closes UI-563