bug: Reaction popups are cut off by the channel header or composer (DialogAnchor can't use `fitAvailableSpace`)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 62/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- react, typescript
- Domain
- frontend
Research direction
Start in src/components/Dialog/service/DialogAnchor.tsx and useDialogAnchor, where fitAvailableSpace needs to be accepted and passed to usePopoverPosition, which already supports it for Dropdown. Then check MessageReactions and ReactionSelectorWithButton so they pass the option through. In the ResizeObserver callback, defer update with requestAnimationFrame and cancel it on cleanup to avoid the loop warning. Done when the reaction popups cap their height to the available space and scroll, with no ResizeObserver loop error in the console.
Written by the indexing model from the issue text.
Description
Describe the bug
The reaction popups open through DialogAnchor: the list of who reacted (MessageReactions), and the reaction selector with its "+" list of every emoji (ReactionSelectorWithButton). When one is taller than the space on both sides of the message, floating-ui flips it to the roomier side, but it still overflows. The channel header or the composer then covers part of it.
usePopoverPosition already supports fitAvailableSpace, which caps the floating element's height to the space available. Only Dropdown uses it today. DialogAnchor and useDialogAnchor don't accept or pass it through, so the reaction popups can't use it.
A second problem shows up once it's turned on. With updatePositionOnContentResize, useDialogAnchor calls update directly inside its ResizeObserver callback. Fitting the dialog resizes it again during that same callback, and the browser logs "ResizeObserver loop completed with undelivered notifications".
To Reproduce
- Open a channel in a short window, for example about 600px tall.
- On a message near the middle of the list, open the reaction selector and expand the full emoji list with "+". Or open the reactions detail on a message with many reactions.
- The popup extends under the channel header or the composer.
Expected behavior
The popup's height is capped to the space on the side it opens toward, and its content scrolls.
Suggested fix
We've patched the built ES output. We can open a PR against the source, with a test, if you'd like:
- Add
fitAvailableSpacetoDialogAnchor's props and touseDialogAnchor, and pass it tousePopoverPosition. - Pass
fitAvailableSpacefromMessageReactionsandReactionSelectorWithButton. - In the
ResizeObservercallback, deferupdateto the next animation frame, and cancel that frame on cleanup:
let frame = 0;
const resizeObserver = new ResizeObserver(() => {
cancelAnimationFrame(frame);
frame = requestAnimationFrame(update);
});
resizeObserver.observe(popperElement);
return () => {
cancelAnimationFrame(frame);
resizeObserver.disconnect();
};
Our workaround
The patch described above, applied to dist/es and the types with pnpm's patchedDependencies.
Package version
- stream-chat-react: 15.0.0. The same code is in 15.0.2, checked in source (
src/components/Dialog/service/DialogAnchor.tsx). - stream-chat-js: 10.0.1
Desktop
- Chrome on macOS
Additional context
App id: 67855
- Dominant language
- TypeScript
- Stars
- 845
- Forks
- 295
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 106
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from GetStream/stream-chat-react
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
GetStream/stream-chat-react#3467 ·
Maintainers usually reply within 1 day
-
bug: Composer textarea doesn't resize when the SDK sets its text (paste, draft, clear after send)Open
Difficulty 3/5 1-2 days Newbie friendliness 62/100
GetStream/stream-chat-react#3468 ·
Maintainers usually reply within 1 day
-
bug status: unconfirmed
Difficulty 4/5 3-5 days Newbie friendliness 42/100
GetStream/stream-chat-react#2647 · 2 comments ·
Maintainers usually reply within 1 day
-
dependencies
Difficulty 3/5 1-2 days Newbie friendliness 52/100
GetStream/stream-chat-react#1982 · 8 comments · 1 reaction ·
Maintainers usually reply within 1 day
All issues in GetStream/stream-chat-react
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
siyuan-note/siyuan#21692 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 2 days
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
resend/resend-node#1206 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
cloudflare/cloudflare-typescript#2821 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
vercel-labs/ui#1139 ·
Maintainers usually reply within 1 day