Repository navigation
fix(observer): 覆盖层真的滑进滑出——把皮肤早已声明的 280ms 过渡接上真实消费者 - #229
Merged
Merged
Conversation
b10.css 早就写了 .drawer{transition:right .28s cubic-bezier(.2,0,0,1)} 与 .toast{transition:.22s ease},
drawer.tsx 顶部的 L6 权威注释写的就是 280ms 滑入;但两个组件挂载时就把 open/show 一起画上,
浏览器只被告知一个状态,没有两次绘制之间的差可动,所以那 280ms 从来没发生过。
新增 useEnterTransition:先按关闭态画一帧,第二帧才切开启态(单帧会把首绘与变更合并,那是跳切);
关闭时先摘类、等 exitMs 再卸载,且用定时兜底而不是 transitionend——l10b-shell.css 在
prefers-reduced-motion 下整体关掉过渡,等一个永不到来的事件会把面板永远留在文档里。
吐司按行持有状态,避免新到的一条跟着第一条一起跳。
门的读数(同一条 CDP 会话,真实点击顶栏控件):修复前两面 NOT_ANIMATED;修复后
drawer animated:{"right":17,"exit:right":14}、toast animated:{"transform":13,"opacity":13},
首帧类名由 'drawer open' 变 'drawer',right 依次 -540px→-516.658px→…→0px,
Escape 后还有 18 帧在画退场才卸载(原来 0 帧)。overlay_enter_transitions 由报告升格为断言。
新增 overlayEnter.contract.test.tsx 7 例(含从 b10.css 正则读声明时长与常量比对:皮肤改了组件没跟上就判红);
tests/ci/test_overlay_motion_gate.py 11→12 例,反证是"挂载即在终态"这一旧形状。
npx vitest run 78 文件 963 例全绿、tsc 0 错、build 成功、门 PASS。
headless Chrome 自己会回答这个媒体偏好,不钉就是在测环境而不是测规则——按下态门 2026-10-26 已为此付过学费。 emulate_motion 先 setEmulatedMedia 再把 matchMedia 读回来核对,读不回期望值就记 preference-not-pinned 拒测; 每面测两个分支,新增 overlay_motion_preference_pinned 与 overlay_reduced_motion_arrives_without_frames。 判据第一版写错被实测纠正:把"无中间帧"写成"只能一个值",而正确的 reduce 行为是先画关闭帧再到终点 (right 恰好两值 -540px → 0px,中间无帧),旧写法会冤枉产品的无障碍地板;改为"最多两值且终点与正常分支逐字相同", 并补一例把这条正确形状钉住。正常分支仍测得 17 个中间值,门 OVERLAY_MOTION_GATE_PASS、单测 16 例全绿。
Owner
Author
|
补充(提交 headless Chrome 自己会回答
一处判据写错、被实测纠正(值得单独记):第一版把"无中间帧"实现成"只能有一个值"。实测正确的 reduce 行为是先画关闭帧、再到终点, 读数:正常分支 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
这是缺陷修复,不是新特性
钉住的
apps/observer/frontend/src/skins/b10.css早就声明了:而
apps/observer/frontend/src/components/ui/drawer.tsx与toast.tsx挂载时就把open/show一起画上。过渡需要两次绘制之间的差;浏览器只被告知一个状态,于是那 280ms 滑入从来没有发生过——
drawer.tsx顶部的 L6 权威注释写的正是"280ms cubic-bezier(0.2,0,0,1) slide from the right"。上一批建的
scripts/audit/overlay_motion_via_cdp.py把这个事实量成了NOT_ANIMATED(本 PR 把它从报告升格为断言)。改法
新增
apps/observer/frontend/src/lib/useEnterTransition.ts:exitMs再卸载;这个等待是定时兜底而不是transitionend,因为
apps/observer/frontend/src/skins/l10b-shell.css在prefers-reduced-motion下整体关掉过渡,等一个永不到来的事件会把面板永远留在文档里;
门的实测(同一条 CDP 会话、真实点击顶栏控件)
NOT_ANIMATED,首帧类名drawer openanimated:{"right": 17, "exit:right": 14},首帧类名drawer,right依次-540px → -516.658px → -414.969px → … → 0px;Escape 后还有 18 帧在画退场才卸载(原来 0 帧)NOT_ANIMATED,首帧类名toast showanimated:{"transform": 13, "opacity": 13},首帧类名toastOVERLAY_MOTION_GATE_PASS overlays=["drawer","toast"],新判据overlay_enter_transitions[面];收据
.project-local/runs/overlay-gate/overlays-after.json。合同与判据两侧一起改
apps/observer/frontend/src/components/ui/overlayEnter.contract.test.tsx7 例:第一帧是关闭态;关闭后先留在文档里把退场画完、超过声明时长才卸载;
退场预算从
b10.css正则读.28s/.22s与常量比对(皮肤改了而组件没跟上就判红);"先画关闭态不等于把内容藏起来"(文本仍在
screen上读得到)。tests/ci/test_overlay_motion_gate.py11 → 12 例:反证正是"挂载即在终态"这一旧形状。overlay_enter_transitions断言的是**默认(无 reduce)**媒体偏好下的行为——本门不 emulateprefers-reduced-motion;将来加 reduce 分支时该判据必须换成"直接到达终态且无中间帧"。本地门
npx vitest run78 文件 963 例全绿(77/956 → 78/963)、npx tsc --noEmit0 错、npm run build成功;清单在
git add之后重发、test_tool_inventory_coverage.py16 例绿;台账四门绿:路径门 36 例、
normalise_doc_citations --checkrewritten=0 blocked=0、verify_register_table_shaperows=42、verify_live_doc_paths_resolvemissing=0。按名留档
吐司的退场目前仍是"从列表移除",
TOAST_EXIT_MS已声明但还没有消费它的路径——接成真正退场需要
useToaster保留 leaving 项,属下一批;CL-16 第 3 步(motion@的LazyMotion+m)现在有了可断言的地面。