mirror of
https://github.com/coder/coder.git
synced 2026-11-09 22:23:27 +08:00
WebKit internally adjusts scrollTop during layout when content above the viewport changes height, even with overflow-anchor:none. These phantom adjustments fire scroll events where isNearBottom returns false. The scroll handler was setting autoScrollRef = nearBottom on every such event, permanently killing follow mode. The scroll handler now only enables follow mode, never disables it. When follow mode is active, the user is not wheel/touch scrolling, and isNearBottom is false, this indicates a browser-initiated scroll adjustment. Re-pin immediately and set the restore guard so the pin's own scroll event is suppressed. Disabling follow mode is exclusive to user-interaction handlers (wheel, touch, scrollbar pointerdown) via handleUserInterrupt. Guard-clear callbacks also check isNearBottom before dropping the restoration flag, re-pinning if content grew between the pin and the clear.