Skip to content
This repository was archived by the owner on Sep 16, 2026. It is now read-only.
This repository was archived by the owner on Sep 16, 2026. It is now read-only.

Scrollbar gets stuck in bottom after scrollable content becomes shorter #207

Description

@andrewvarga

Is your feature request related to a problem? Please describe.

Not sure if this is a bug report or a feature request, but I have a problem:

  • I have a vertically scrollable content
  • I go to the bottom of the scroll
  • then I remove some items from the content programatically so that the scrollable content is now smaller in height than the visible area (clientHeight) so there is nowhere to scroll to.

After this the scroll position is still at the bottom even though there is no content there, and so when I start scrolling up, the scrollbar gets smaller and eventually disappears.

Describe the solution you'd like

It would be good if this was caught automatically and the scrollbar would disappear if the content to be scroller becomes smaller.

Describe alternatives you've considered
I could detect if that happens in onUpdate but it feels like a hack:

let scrollTop = rect.scrollTop;
const extraThresholdToAvoidFlickering = 5;
const hasScrolledIntoEmptyBottomArea = rect.scrollHeight - extraThresholdToAvoidFlickering > rect.contentScrollHeight;
if (hasScrolledIntoEmptyBottomArea) {
   scrollTop = 0;
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions