[webkit-changes] [WebKit/WebKit] 9dcecd: [iOS] Smooth keyboard scrolling animates in the wr...

Wenson Hsieh noreply at github.com
Wed Oct 11 14:12:50 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9dcecd144778336ce80abbf264cc67d2e2b0b20b
      https://github.com/WebKit/WebKit/commit/9dcecd144778336ce80abbf264cc67d2e2b0b20b
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2023-10-11 (Wed, 11 Oct 2023)

  Changed paths:
    M Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm

  Log Message:
  -----------
  [iOS] Smooth keyboard scrolling animates in the wrong direction when pressing ↓ after scrolling up
https://bugs.webkit.org/show_bug.cgi?id=263028
rdar://116823122

Reviewed by Tim Horton and Richard Robinson.

The logic to compound existing interactive scrolling velocity (i.e. when panning or decelerating
after a pan gesture) on top of the current keyboard scrolling velocity in `-beginWithEvent:` is
intended to make it so that the user can naturally transition between scrolling normally and the
scroll view and using arrow keys to trigger keyboard scrolling, without the scrolling velocity being
reset to 0 upon pressing an arrow key.

However, this can lead to some pretty unintuitive behaviors when the user flings the scroll view in
one direction, but presses an arrow key in the opposite direction to scroll the web view; this
causes the scroll view to accelerate in the opposite direction as the arrow key, before snapping
back to the starting position (or, in the case where we're rubber-banding against the scroll
extents, we can end up in a state where we're permanently stuck rubber-banding, until the user
touches the scroll view).

To fix this, we simply limit this velocity compounding to only the case where interactive scrolling
is in the same direction as keyboard scrolling. This means that in the scenario described above,
we'll now interrupt momentum scrolling immediately, and begin scrolling in the direction of the
arrow key.

* Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm:
(-[WKKeyboardScrollingAnimator beginWithEvent:]):

Canonical link: https://commits.webkit.org/269219@main




More information about the webkit-changes mailing list