Skip to content

LightScrollView's scrollbar flashes for one frame while new content settles #56

Description

@ChopinDavid

Summary

LightScrollView decides scrollbar visibility from a single frame's scrollState.maxValue reading. When the content inside it is swapped, the new subtree's first layout pass can transiently measure taller than its final geometry (common with async images and fillMaxWidth().aspectRatio(...) children, whose height resolves after width). The scrollbar renders for exactly that one settling frame. The flash occurs even when neither the old nor the new content overflows, i.e. when no scrollbar was ever warranted.

Similar to #50, but distinct because this is a one-frame transient, not the infinite loop.

bug2.mov

Reproduction

Steps

  1. Put content inside a LightScrollView that fits the viewport.
  2. Swap it in place for other fitting content whose subtree takes a frame to reach final geometry (e.g. contains an aspectRatio image).
  3. Watch the right edge (a 60fps screenrecord makes it easy to catch).

Expected Result

No scrollbar, both states fit.

Actual Result

The scrollbar appears for one frame during the swap, then vanishes.

Suggested fix

Only show the scrollbar when the overflow persists to the next frame (hiding stays immediate). Genuinely scrollable content shows its bar one frame later, which should be imperceptible.

I have this fix ready on the same branch that addresses #50, so one PR can potentially close both, but we need to determine what approach we want to take on #50 first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions