Repository navigation
fix(Dialog): fit dialogs and popovers to the available space - #3471
Open
MartinCupela wants to merge 2 commits into
Open
MartinCupela wants to merge 2 commits into
MartinCupela wants to merge 2 commits into
Conversation
Dialogs no longer get cut off by the window or cover the channel header, the composer or the button that opened them. - DialogAnchor fits the available space by default (`fitAvailableSpace`): it stays inside its dialog overlay, opens above, below or beside its reference, and on the roomiest side when none fits, capped to the space there but never below one and a half items. Flip measures the uncapped content, so a dialog that grew moves to the roomier side. - Capped context menus scroll; the reactions detail user list shrinks. - The ResizeObserver update for `updatePositionOnContentResize` runs in the next animation frame, avoiding a "ResizeObserver loop" error. - The composer emoji picker and suggestion lists (emoji, mentions, commands) fit the space too, without covering the text field. - The vite example's draggable panel opts out. Ticket: REACT-1627 Fixes #3466 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`scrollIntoView` also scrolled the sidebar in short windows, pushing the icon rail and the list header out of view. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MartinCupela
requested review from
NikolaGoranNaumovski and
oliverlaz
as code owners
November 26, 2026 14:45
Contributor
|
Size Change: +2.33 kB (+0.21%) Total Size: 1.13 MB 📦 View Changed
ℹ️ View Unchanged
|
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.
Ticket: https://linear.app/stream/issue/REACT-1627
Fixes #3466
🎯 Goal
In a short window, reaction popups, the message actions menu, the emoji picker and the composer suggestion lists ran past the window, covered the channel header or composer, or covered the button that opened them.
🛠 Implementation details
DialogAnchorfits the available space by default (fitAvailableSpace, defaults totrueonDialogAnchor,falseonuseDialogAnchor). A dialog:updatePositionOnContentResize: the position update runs in the next animation frame (cancelled on close and unmount), avoiding the "ResizeObserver loop" error.Behaviour change for integrators: dialogs they build with
DialogAnchorfit by default too. The cap is an inlinemax-height/max-width, which overrides those properties in their CSS, and the dialog's children are laid out as a shrinkable column. Opt out withfitAvailableSpace={false}.Known limits:
ContextMenuButtonwithSubmenu) andDropdownaren't covered.Tests cover the overlay boundary, opening beside the reference, the one-and-a-half-item minimum, flipping a grown dialog, the deferred update and its cleanup, and the defaults on context menus, the emoji picker and the suggestion list. All new tests fail on
master.Bundle: +432 B min+gzip JS, +60 B gzip CSS.
🎨 UI Changes
Checked in the vite example at 1021×253, 800×450 and 800×600: no dialog or list is cut off or covers its trigger.
🤖 Generated with Claude Code