Skip to content

Fix ScrollContainer scroll buttons not reflecting overflow immediately#4414

Merged
tgargula merged 7 commits into
mainfrom
tomasz/fix-scroll-further-button
Jul 20, 2026
Merged

Fix ScrollContainer scroll buttons not reflecting overflow immediately#4414
tgargula merged 7 commits into
mainfrom
tomasz/fix-scroll-further-button

Conversation

@tgargula

@tgargula tgargula commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Extracted scroll overflow tracking into a custom hook (useScrollOverflow) to improve code reuse and ensure overflow state is detected immediately when content changes dynamically. This fixes the "Scroll further" button in search results not appearing right away for overflowing content.

Changes

  • Created new useScrollOverflow hook to centralize scroll position and overflow tracking
  • Updated ScrollContainer to use the new hook
  • Added test ID to ScrollContainer for improved e2e test selectors
  • Enhanced e2e tests to verify the scroll button reflects overflow immediately without manual scrolling

Demo

Before

Screen.Recording.2026-07-17.at.12.55.25.mov

After

Screen.Recording.2026-07-17.at.12.56.12.mov

E2E tests

image

🤖 Generated with Claude Code

resolves RND-11974

tgargula and others added 3 commits July 17, 2026 12:38
The scroll-further buttons relied on scroll/resize events to detect
overflow, so they lagged behind content changes (e.g. new search
results) until a manual scroll or window resize fired. Measure
synchronously on mount/content change and observe children as well as
the container so overflow is detected right away.
Extract scroll overflow tracking into a custom hook to improve reusability and ensure overflow is detected immediately when content changes. Add test ID to ScrollContainer for better e2e testability.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e432c13

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
gitbook Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@tgargula tgargula self-assigned this Jul 17, 2026
@argos-ci

argos-ci Bot commented Jul 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
customers-v2-cloudflare (Inspect) 👍 Approved by Tomasz Gargula 16 changed, 7 ignored Jul 20, 2026, 8:10 AM
customers-v2-vercel (Inspect) 👍 Approved by Tomasz Gargula 20 changed, 5 ignored Jul 20, 2026, 8:08 AM
v2-cloudflare (Inspect) 👍 Approved by Tomasz Gargula 1 changed, 2 ignored Jul 20, 2026, 8:11 AM
v2-vercel (Inspect) ✅ No changes detected 1 ignored Jul 20, 2026, 8:09 AM

Comment thread packages/gitbook/e2e/internal.spec.ts Outdated
Comment thread packages/gitbook/src/components/hooks/useScrollOverflow.ts Outdated
Comment thread packages/gitbook/src/components/hooks/useScrollOverflow.ts
tgargula and others added 2 commits July 17, 2026 17:41
Measure on every render instead of tracking children dependency. This ensures overflow state is always in sync with the current DOM without needing to manually track prop changes.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
…IO/gitbook into tomasz/fix-scroll-further-button
Comment thread packages/gitbook/src/components/hooks/useScrollOverflow.ts
Remove flaky internal.spec.ts scroll test and the SearchFrame ref export that was only needed for testing, reducing test burden while keeping the useScrollOverflow hook logic intact.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@tgargula
tgargula enabled auto-merge (squash) July 20, 2026 08:03
@tgargula
tgargula merged commit 484cc11 into main Jul 20, 2026
17 checks passed
@tgargula
tgargula deleted the tomasz/fix-scroll-further-button branch July 20, 2026 08:47
@linear-code

linear-code Bot commented Jul 20, 2026

Copy link
Copy Markdown

RND-11974

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.

2 participants