GitHub(@github)

Any “is the user interacting?” check has to distinguish real user input from scrolls caused by your ...

7.5内容质量
Any “is the user interacting?” check has to distinguish real user input from scrolls caused by your ...

TL;DR · AI 摘要

GitHub分享了在处理PR视图时区分用户真实输入与自身滚动副作用的技术挑战与解决方案。

核心要点

  • 渲染百万行差异时评论高度受markdown包裹、图片加载等动态因素影响
  • timestamp guard机制因程序化滚动导致误判需要重新设计
  • 侧边栏切换触发的布局重排会产生0.5px级微滚动需特殊处理

结构提纲

按章节快速跳转。

  1. 介绍GitHub在处理超大PR时遇到的交互检测难题

  2. 动态内容渲染导致的滚动事件误判问题

  3. 程序化滚动刷新时间戳导致交互检测失效

  4. 侧边栏切换触发的微滚动干扰用户交互判断

  5. 通过空间隔离和时间衰减算法优化滚动事件检测

思维导图

用一张图看清主题之间的关系。

查看大纲文本(无障碍 / 无 JS 友好)
  • GitHub PR视图交互挑战
    • 核心挑战
      • 动态内容渲染问题
      • timestamp guard缺陷
      • 布局重排影响
    • 解决方案
      • 空间隔离算法
      • 时间衰减检测
      • 微滚动过滤机制

金句 / Highlights

值得收藏与分享的关键句。

#前端#用户体验#滚动事件处理
打开原文

GitHub on X: "Any “is the user interacting?” check has to distinguish real user input from scrolls caused by your own side effects." / X

[](https://x.com/)

GitHub on X: "Any “is the user interacting?” check has to distinguish real user input from scrolls caused by your own side effects."

  • ![Image 1: Avatar](https://x.com/github) GitHub @github 14h Rendering a million-line diff is the easy part. 👀 Comments are what break it. Their height depends on markdown wrapping, expanded details, open reply boxes, and images still loading (none of which you know until you render). Here's how we rebuilt the PR view in the GitHub Show more 40 12 262 66K
  • ![Image 2: Avatar](https://x.com/github) GitHub @github 14h One bug that held us back was “don’t correct while you’re scrolling.” It was a timestamp guard, and our own programmatic scrolls refreshed it. Toggle the sidebar, and the diff pane changes width. Wrapped lines reflow, and the surface emits a small scroll as it settles. The guard Show more 1 1 1K
  • ![Image 3: Avatar](https://x.com/github) GitHub @github Any “is the user interacting?” check has to distinguish real user input from scrolls caused by your own side effects. 6:06 PM · Oct 12, 2026·7,179 Views 1 3 1
  • ![Image 4: Avatar](https://x.com/github) GitHub @github 14h Open the worst pull request you’ve got and try it out 👇 ![Image 5 Rendering huge pull requests in the GitHub Copilot app](https://t.co/sTqDfD0F2C)From github.blog 2 8 7.4K

Log in or sign up for X

See what’s happening and join the conversation

Continue with phoneContinue with Apple

Continue with Google

通过 Google 继续操作 通过 Google 继续操作。在新标签页中打开

or

Log in with username or email