Skip to content

virtual-core: a hold left behind a smooth scroll command is not written when the command ends (WebKit wheel hold) #1406

In review

Description

@piecyk

Follow-up from #1400 (merged in d40d8c8), where this came up in review and was left out on purpose.

What happens

In WebKit, corrections are held for 150ms after a wheel event (#1400). If that hold is created while a smooth scroll command is travelling, nothing writes it when the command ends:

  1. scrollToIndex(0, { behavior: 'smooth' })
  2. a wheel event while it travels
  3. a prepend inside the 150ms window, so the anchor delta is held (say 600px)
  4. the wheel timer ends, but _flushHoldIfReady waits because the phase is still smooth
  5. the element reaches 0, the layout is still at 600, and the command never sees its target

After the 5s safety valve the command is dropped and the hold is still pending. The list sits on the old first row, 600px short of row 0, until the next wheel event, scroll or render. Without the wheel event in step 2 the same sequence lands on row 0.

Why it wasn't fixed in #1400

The obvious fix is to release any pending hold when a command starts or ends. That also changes the iOS touch hold and the bounce hold, 23 scroll-trace snapshots move. So it needs its own look at what a command should do with a hold that isn't from the wheel.

Notes

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