Skip to content

fix(react-core): stabilize pin-to-send scrolling - #5386

Merged
tylerslaton merged 1 commit into
CopilotKit:mainfrom
westkite1201:fix/5355-pin-to-send-scroll
Jun 12, 2026
Merged

tylerslaton merged 1 commit into
CopilotKit:mainfrom
westkite1201:fix/5355-pin-to-send-scroll

Conversation

@westkite1201

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes pin-to-send scrolling in the v2 chat view.

  • Re-attaches the non-autoscroll scroll listener after the real scroll element mounts by depending on nonAutoScrollEl, not the stable scrollRef object.
  • Lets the usePinToSend spacer adjust in both directions as content below the pinned user message changes, so the user message stays anchored after streaming finishes and layout height changes.
  • Adds regression coverage for the scroll-to-bottom button and spacer adjustment behavior.

Related PRs and Issues

Fixes #5355

Tests

  • corepack pnpm -C packages/react-core exec vitest run src/v2/hooks/__tests__/use-pin-to-send.test.tsx src/v2/components/chat/__tests__/CopilotChatView.pinToSend.test.tsx
  • corepack pnpm exec oxfmt --check packages/react-core/src/v2/components/chat/CopilotChatView.tsx packages/react-core/src/v2/hooks/use-pin-to-send.ts packages/react-core/src/v2/hooks/__tests__/use-pin-to-send.test.tsx packages/react-core/src/v2/components/chat/__tests__/CopilotChatView.pinToSend.test.tsx
  • git diff --check

Attempted:

  • corepack pnpm -C packages/react-core run check-types
    • This failed in the local workspace on existing/type-resolution issues outside this diff, including react-markdown JSX namespace errors, missing @copilotkit/runtime-client-gql declarations, and existing e2e mock AbstractAgent private member mismatches.

Checklist

  • I have read the Contribution Guide
  • If the PR changes or adds functionality, I have updated the relevant documentation (N/A: bug fix only, no API/docs change)
  • "Allow edits by maintainers" is checked (lets us help iterate on your PR directly — faster turnaround for everyone)

@vercel

vercel Bot commented Jun 11, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Jun 11, 2026 2:00pm

Request Review

@vercel

vercel Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

@westkite1201 is attempting to deploy a commit to the CopilotKit Team on Vercel.

A member of the Team first needs to authorize it.

@tylerslaton

Copy link
Copy Markdown
Contributor

Thank you for the contribution @westkite1201!

@tylerslaton
tylerslaton merged commit 930e182 into CopilotKit:main Jun 12, 2026
4 of 8 checks passed
tylerslaton added a commit that referenced this pull request Jun 16, 2026
…er message pinned (#5423)

## What does this PR do?

Ports the `usePinToSend` spacer fix from #5386 to the Vue package.
`packages/vue/src/v2/hooks/use-pin-to-send.ts` is a documented 1:1
parity port of the React hook and retained the shrink-only
`ResizeObserver`: when content below the anchored user message loses
height (suggestions swapping in, input container resizing after
streaming), the spacer could not grow back, so total scrollable height
dropped and the pinned message shifted — the same defect class reported
in #5355.

- Lets the spacer adjust in both directions so total scrollable space
below the pinned bubble stays constant.
- Mirrors the test change from #5386 1:1 in the Vue suite (red/green:
the updated assertion fails on the shrink-only implementation, passes
with the fix).
- Updates the `PARITY.md` row and hook JSDoc that documented the old
shrink-only semantics.

Vue has no scroll-to-bottom button, so the scroll-listener half of #5386
does not apply here.

## Related PRs and Issues

- Follow-up to #5386
- Relates to #5355 (Vue side of the same spacer defect)

## Tests

- `nx test @copilotkit/vue` — 1001 passed (94 files), including the
mirrored `adjusts spacer as content height changes to keep the user
message pinned` case
- `nx build @copilotkit/vue` — green (dts build)
- `oxfmt --check` clean on touched files
- Pre-existing on main, untouched by this diff: 176 package-wide lint
errors (identical count on clean main) and
`@copilotkit/core:check-types` failures

🤖 Generated with [Claude Code](https://claude.com/claude-code)
huangyingting pushed a commit to repomesh/CopilotKit that referenced this pull request Jun 16, 2026
…er message pinned

Ports the usePinToSend half of CopilotKit#5386 to the Vue package, which is a
documented 1:1 parity port and retained the shrink-only ResizeObserver.
When content below the anchored user message loses height (suggestions
swap, input resize), the spacer now grows back so total scrollable space
below the bubble stays constant and the message stays pinned (CopilotKit#5355).
Vue has no scroll-to-bottom button, so the listener half of CopilotKit#5386 does
not apply.

This branch was successfully deployed

1 active deployment
Preview – docs — 8e440a9e Deployed Jun 11, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Bug: Scroll to bottom button not appearing and user message shifts after streaming finishes in "pin to send" autoscroll mode

2 participants