Peach: Local-first video metadata scraper and media manager.
fix(web): 窄屏顶栏改为 fixed,手机聚焦搜索框时页面不再被 Safari 往上滚
longmeidao81c0952dde03
diff --git a/docs/HANDOFF.md b/docs/HANDOFF.mdindex 86758ab30..a6d6b470c 100644--- a/docs/HANDOFF.md+++ b/docs/HANDOFF.md@@ -91,7 +91,7 @@ React 渲染的规格页、用户截图这类给不出可重抓字节的实测- 表格、排行与面包屑:`vercel-geist-table-ranking`、`vercel-geist-breadcrumbs`;同形可比较数据才用语义 `table` 并保持 tabular numerals,内容标签是固定 Top 排行和直接筛选,不伪装成可排序数据表。- 设置 Dialog 动效、搜索期 Spinner、后台 Loading Dots 与 busy 按钮:`vercel-geist-command-search-loading`;中性说明 Note:`vercel-notifications-note`;具名动作 Toast:`vercel-geist-toast`;确认弹层(2026-09-06):`vercel-geist-modal-measured`。- 资料页阅读顺序与照片入口:`beeg-profile-layout`;JAV 标题显示语义:`jav-title-user-screenshot`;卡片悬停的快退/快进控件:`hover-seek-controls-user-screenshot`(beeg 现网没有这个控件,只依据用户截图)。-- 播放器控制栏、设置浮层、影院与全屏几何:`youtube-player-controls-user-screenshot`;沉浸页版式:`youtube-shorts-immersive-user-screenshot`;播放统计历史:`youtube-stats-buffer-measured`;小窗与右键菜单:`youtube-miniplayer-measured`。Peach 不复制字幕、睡眠定时或自动播放按钮。+- 播放器控制栏、设置浮层、影院与全屏几何:`youtube-player-controls-user-screenshot`;沉浸页版式:`youtube-shorts-immersive-user-screenshot`;播放统计历史:`youtube-stats-buffer-measured`;小窗与右键菜单:`youtube-miniplayer-measured`;手机顶栏:`youtube-mobile-topbar-measured`。Peach 不复制字幕、睡眠定时或自动播放按钮。- 追更与文件站的凭据与解析边界:`f95-masked-gofile-media`、`follow-fanbox-gofile-paheal`、`fanbox-browser-transport`、`rule34-follow-tags-and-collections`;厂牌 Logo 候选发现:`fiu758-studio-logo-discovery`,只作发现来源不作真相源。- 通用评审清单与报告型页面版式:`vercel-web-interface-guidelines`、`vercel-report-design`(`vercel.com/design.md`)。- 默认 Note、只读提示和 info 入口统一复用本地 Lucide 圆圈 `i`,显式使用 2px 描边与圆端点保证圆点可见,不复制未开放许可的 Geist 私有 SVG。diff --git a/docs/reference-snapshots/youtube-mobile-topbar-measured.md b/docs/reference-snapshots/youtube-mobile-topbar-measured.mdnew file mode 100644index 000000000..761040ff9--- /dev/null+++ b/docs/reference-snapshots/youtube-mobile-topbar-measured.md@@ -0,0 +1,56 @@+# YouTube 手机版顶栏定位与 iOS 聚焦显露取证++- 取证日期:2026-09-14+- 来源:以 iPhone Safari UA 抓取 <https://m.youtube.com/>,读取页面引用的样式与主脚本;浏览器面板+ 直接打开 m.youtube.com 时静态资源被 `net::ERR_BLOCKED_BY_CLIENT` 拦下,运行时 DOM 与计算样式未取得+- 页面 HTML:SHA-256 `39ff5e1a9943f67941144b154433cc66882e3ab031585ec8a972b9bc4f36a8e9`+- 样式:<https://m.youtube.com/s/_/ytmweb/_/ss/k=ytmweb.c3_base.XeCffbT4X_0.L.W.O/am=AAAAAMCAIAA2Gw/d=1/rs=ABnK5FJvcTupHzma809lM5L8XX7s02z7Fg/m=root,c3_base,PzUdZb,DlvF1d,Tu3MB,SFvGjc,HDmU1e,cDTHu,JoU6vf,OM7xob,UAM5m,Di4hBc,dpUCFd,oPp5Le,A4oAVe,Nr0kfe>,+ SHA-256 `3845f625f33dd1c13589b1cb615002814f2c775b27b3faeaaebd59d9c2c69ce3`+- 主脚本:`ytmweb.c3_base.en_US.sBXzZErQDoA.2021.O`,SHA-256+ `7fd8ff3934588640fe2f026af8f42b2a8fd92828cb5a03cc1eae2fe3be1087cb`++## 实测规则++- 顶栏:`ytm-header,ytm-header-bar,ytm-mobile-topbar-renderer{position:fixed;top:0;left:0;right:0;z-index:4}`;+ 新顶栏 `.ytTopBarViewModelHost` 同样 `position:fixed;top:0;left:0;right:0;z-index:4`,左右让出安全区。+- 正文让位:`ytm-app` 在 `.sticky-player` 下与宽屏竖屏断点下都是 `padding-top:48px`。+- 搜索态:`.ytTopBarViewModelHost[data-mode=searching]` 在 fixed 顶栏里就地换成搜索框,隐藏尾部按钮;+ 建议列表 `.ytSearchboxComponentSuggestionsContainerScrollable{overflow-y:auto;max-height:80vh}` 自己滚。遮罩 `search-scrim` 只在 AI 搜索开关打开时由脚本挂上。+- 视口 meta:`width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no,viewport-fit=cover`。+- 模态层锁滚动:脚本给 body 加 `modal-open-body` 并写负的 `top`,样式+ `[modal-open-body]{position:fixed;left:0;right:0}`;关闭时 `window.scrollTo` 回原位。搜索态是否走+ 这把锁未取得。+- 主脚本里没有 `visualViewport`,也没有 `preventScroll`。++## Peach 录屏测量++用户录屏 `ScreenRecording_09-14-2026 16-16-23_1.mp4`(220×480,7.1 秒)按每秒 5 帧抽帧:按下搜索键+后 0.4–0.8 秒内整页平滑上滚,卡片标题在帧内下移约 115px,折合 CSS 约 200px;顶栏始终贴在状态栏+下方,筛选框随上滚翻出。Chrome 手机模拟里同样操作 `scrollY` 不变、没有 scroll 事件,上滚来自+Safari 本身。++## WebKit 源码对照++取自 WebKit 主干(抓取后查询到的 revision `e4d6f095cfbba338af740f00311e48c8e3c5dd4e`):++| 文件 | SHA-256 | 相关位置 |+| --- | --- | --- |+| `Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm` | `652313858143462cec3aed61cf5f1cdabdffc488149173091360474157fb3180` | `_zoomToRevealFocusedElement` 先看 `preventScroll`;`_elementDidBlur` 把它清回 false |+| `Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm` | `d3bfab63fdf1802e0283045fd67f4c6d5922565e084ab3583a526441e6faae08` | `_zoomToFocusRect` 在带表单辅助栏时强制把输入框居中到键盘上方;`_scrollToAndRevealSelectionIfNeeded` 在键盘尺寸变化时触发,不看 `preventScroll` |+| `Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm` | `fcd637987289046b66443fd1bc4d93bf5ba2ddd222649654791ff623839bfc3c` | `emitDeferredFocusedElementUpdate` 是唯一写入 `preventScroll` 的地方 |+| `Source/WebKit/WebProcess/WebPage/WebPage.cpp` | `40da5feb3201444d263352d63922d93a0512da5add4d517b7877729a18a896f2` | `elementDidFocus` 把 FocusOptions 放进挂起更新 |+| `Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm` | `076031a4b537130f63be46d8c6dbce83fc3097143f2f4231d3a5ac289f110c90` | 子滚动节点按 `canHaveScrollbars` 设 `scrollEnabled`;主滚动视图恒为可滚,根上 `overflow:hidden` 挡不住上面那条显露 |++居中公式按录屏几何估算的上滚量与实测约 200px 同一量级,但哪一条路径在用户机型上生效、fixed 顶栏为何+不被带动,未取得真机日志,只能以上线后真机复测为准。++## Peach 采用与差异++- 采用:窄屏 `.top` 改 `position:fixed;top:0;left:0;right:0`,`body` 让出 `var(--topH)`(Peach 为 64px)。+- 保留:搜索键与返回键的 `focus({preventScroll:true})`、搜索框就地展开与返回箭头。+- 不采用:`user-scalable=no`(保留缩放);模态层锁滚动(没有证据表明 YouTube 搜索态使用)。++## 不登记进 docs/reference-sources.json 的原因++样式与脚本是按构建号轮换的打包产物,不是可整体覆盖的上游 Markdown;这里是人工抽取的规则、+录屏测量与源码对照笔记,哈希已记在上面,登记表没有可对应的 snapshot。diff --git a/tests/test_web_ui.py b/tests/test_web_ui.pyindex e53b36224..c0514f664 100644--- a/tests/test_web_ui.py+++ b/tests/test_web_ui.py@@ -4561,13 +4561,13 @@ class WebUiSourceTests(unittest.TestCase):self.assertPageContains("$('#searchBtn').onclick=()=>{setNarrowSearchOpen(true);$('#q').focus({preventScroll:true})};")self.assertPageContains("$('#searchBtn').focus({preventScroll:true});")- def test_mobile_search_bar_follows_the_visual_viewport_above_the_keyboard(self):- # iOS 弹键盘时可视视口在布局视口里往下挪,吸顶顶栏与 fixed 下拉栏按它的偏移贴顶。- self.assertPageContains("$('#searchBtn').setAttribute('aria-expanded',String(open));\n syncSearchViewport();")- self.assertPageContains("window.visualViewport?.addEventListener('scroll',syncSearchViewport);")- self.assertPageContains("root.style.setProperty('--search-viewport-top',")- self.assertPageContains(".top:has(.search.open){overflow:visible;top:var(--search-viewport-top,0px)}")- self.assertPageContains("top:calc(56px + var(--search-viewport-top,0px));max-height:min(70vh,calc(var(--search-viewport-height,100vh) - 64px))")+ def test_narrow_topbar_is_fixed_and_the_page_makes_room_for_it(self):+ # 吸顶顶栏在文档流里,iPhone 聚焦搜索框时 Safari 会把整页往上滚;与 YouTube 手机版一样+ # 顶栏 fixed、正文让出同样高度。+ self.assertPageContains(".top{position:fixed;top:0;left:0;right:0}\n body{padding-top:var(--topH)}")+ self.assertPageContains(".top:has(.search.open){overflow:visible}")+ self.assertPageLacks("syncSearchViewport")+ self.assertPageLacks("--search-viewport-top")def test_glass_compositing_covers_search_snapshots_and_disposed_panels(self):board = (Path(__file__).resolve().parents[1] / 'web/board.css').read_text(encoding='utf-8')@@ -8229,7 +8229,7 @@ class WebUiSourceTests(unittest.TestCase):self.assertPageContains("recommendations.map")self.assertPageContains("rememberSearch(query)")self.assertPageContains("body:JSON.stringify({query})}).catch(()=>null)")- self.assertPageContains(".top:has(.search.open){overflow:visible;")+ self.assertPageContains(".top:has(.search.open){overflow:visible}")self.assertPageLacks("setTimeout(runSearch,320)")self.assertPageContains("runSearch(!picked,true)")@@ -8259,8 +8259,7 @@ class WebUiSourceTests(unittest.TestCase):"""七组补全装不进一屏,滚到底不把身后的列表一起翻走。"""self.assertCode("max-height:min(60vh,520px);overflow:auto;overscroll-behavior:contain;")self.assertCode(- ".searchmenu{position:fixed;left:8px;right:8px;top:calc(56px + var(--search-viewport-top,0px));"- "max-height:min(70vh,calc(var(--search-viewport-height,100vh) - 64px));"+ ".searchmenu{position:fixed;left:8px;right:8px;top:56px;max-height:70vh;""overflow:auto;overscroll-behavior:contain}")def test_a_suggestion_keeps_its_alias_and_count_subordinate(self):diff --git a/web/app.js b/web/app.jsindex 9eaf8fa76..0773e48cf 100644--- a/web/app.js+++ b/web/app.js@@ -10638,7 +10638,6 @@ function setNarrowSearchOpen(open){const anchor=button.getBoundingClientRect();search.classList.toggle('open',open);$('#searchBtn').setAttribute('aria-expanded',String(open));- syncSearchViewport();if(innerWidth>760||matchMedia('(prefers-reduced-motion:reduce)').matches)return;const expanded=search.getBoundingClientRect(),css=getComputedStyle(search);const padding=parseFloat(css.paddingLeft);@@ -10659,19 +10658,6 @@ addEventListener('resize',()=>{searchMorphViewport=innerWidth;finishSearchMorph();},{passive:true});matchMedia('(prefers-reduced-motion:reduce)').addEventListener('change',finishSearchMorph);-/* iOS 弹键盘时布局视口不动,可视视口在它里面往下挪;吸顶的顶栏和 fixed 的下拉栏都跟着- 布局视口走,于是整条被推出屏幕上沿。展开搜索期间把可视视口的偏移和高度交给 CSS,- 顶栏与下拉栏按它贴顶、下拉栏不伸进键盘底下;收起搜索就撤掉。 */-function syncSearchViewport(){- const viewport=window.visualViewport,root=document.documentElement;- if(!viewport||!$('.search').classList.contains('open')){- root.style.removeProperty('--search-viewport-top');root.style.removeProperty('--search-viewport-height');return;- }- root.style.setProperty('--search-viewport-top',`${Math.max(0,Math.round(viewport.offsetTop))}px`);- root.style.setProperty('--search-viewport-height',`${Math.round(viewport.height)}px`);-}-window.visualViewport?.addEventListener('resize',syncSearchViewport);-window.visualViewport?.addEventListener('scroll',syncSearchViewport);$('#searchBtn').onclick=()=>{setNarrowSearchOpen(true);$('#q').focus({preventScroll:true})};/* 窄屏退出搜索。失焦那条 140ms 的兜底只在输入框为空时才收起搜索栏,输入过内容就没有出口了;返回按钮无条件收起,并清掉下拉栏。 */diff --git a/web/css/19-immersive.css b/web/css/19-immersive.cssindex 3aeba7a52..950a0fd1d 100644--- a/web/css/19-immersive.css+++ b/web/css/19-immersive.css@@ -151,9 +151,13 @@ body:has(#batchbar:not([hidden])) #stage{padding-bottom:180px}/* 顶栏在窄屏会被搜索框撑破 —— 搜索收成一个按钮,点了才展开。只裁横向:竖向也裁的话,那几枚玻璃按钮往下落的投影在顶栏下沿被切平,头像那一排上方就多出一条横线。 */.top{gap:4px;padding:0 8px;overflow:clip visible}- /* iOS 弹键盘不缩布局视口,而是让可视视口在里面往下挪,吸顶的顶栏随之被推出屏幕上沿。- 展开搜索期间按脚本量出的可视视口偏移贴顶,见 `syncSearchViewport`。 */- .top:has(.search.open){overflow:visible;top:var(--search-viewport-top,0px)}+ /* 顶栏 fixed、正文让出同样的高度,与 YouTube 手机版同一写法:`ytm-mobile-topbar-renderer`+ fixed 贴顶,`ytm-app` 让出 48px。吸顶顶栏留在文档流里,iPhone 上一聚焦搜索框,Safari 把+ 整页往上滚来显露它(用户录屏量得约 200px),筛选框也跟着翻出来。取证与未取得的部分见+ docs/reference-snapshots/youtube-mobile-topbar-measured.md。 */+ .top{position:fixed;top:0;left:0;right:0}+ body{padding-top:var(--topH)}+ .top:has(.search.open){overflow:visible}.brand h1{font-size:var(--fs-lg)}.ib{width:36px;height:36px}.ib svg{width:19px;height:19px}@@ -174,7 +178,7 @@ body:has(#batchbar:not([hidden])) #stage{padding-bottom:180px}.top:has(.search.open) #selectMode,.top:has(.search.open) #settingsBtn{display:none!important}.top:has(.search.open) .searchback{display:inline-flex;position:absolute;left:8px;top:calc(50% - 18px);z-index:6}- .searchmenu{position:fixed;left:8px;right:8px;top:calc(56px + var(--search-viewport-top,0px));max-height:min(70vh,calc(var(--search-viewport-height,100vh) - 64px));overflow:auto;overscroll-behavior:contain}+ .searchmenu{position:fixed;left:8px;right:8px;top:56px;max-height:70vh;overflow:auto;overscroll-behavior:contain}#searchBtn{display:inline-flex!important}/* 移动端不需要密度切换和筛选抽屉按钮挤在一起 */#density{display:none}