Skip to content

virtual-core: a wheel hold that ends in a bounce at the top still strands a smooth scroll command (WebKit) #1410

Backlog

Description

@piecyk

Follow-up from #1408 (fix for #1406), left out on purpose.

What happens

#1408 writes the wheel hold and aims a travelling smooth command again when the wheel hold ends. That doesn't happen when the hold ends during a bounce at the top:

  1. scrollToIndex(0, { behavior: 'smooth' })
  2. a wheel event while it travels, and a prepend inside the 150ms window, so the anchor delta is held (say 600px)
  3. the element reaches the top and rubber-bands past it (scrollTop -20)
  4. the wheel hold ends during the bounce (the 150ms timer, or the two frames at the top). _canWriteScroll() is false while overscrolled, so nothing is written, which is right, WebKit would drop the write
  5. the bounce settles at 0. The scroll events after it call _flushHoldIfReady(true) without wheelEnded, so the flush waits for the smooth command again, and the command can't land because the layout is still 600 away

Same symptom as #1406: the command sits until the 5s safety valve, then the hold is written and the list ends 600px short of row 0. In the unit harness: during and after the bounce no writes, hold 600, phase smooth; after the valve one write of 600, row 0 at -600.

Why it matters

With a real trackpad in Safari, scrolling up into the top of a list usually bounces, so this may be the common way to hit it, more than the Playwright case #1408 covers. Not checked on a real device yet.

Possible direction

Remember that the wheel hold ended with a write still owed (a smooth command travelling and a hold pending), and pass wheelEnded on the first flush that can write after it, so the bounce settling does the re-aim. A test in wheel-hold.test.ts already pins that nothing is written during the bounce.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions