Repository navigation
fix(x-pro): swap the message-scroller rail preview without a crossfade - #259
Merged
Merged
Conversation
`Transition` 默认模式在切换期间同时保留新旧两张预览卡片,二者钉在轨道同一个 网格单元里交叉淡入淡出:半透明的新卡片透出旧文案,切换瞬间浮层出现重影。 逐帧实测参考实现 beUI MessageScroller 的 rail:全程只有一张卡片,文案在一帧内 直接落到新激活项,卡片位置由轨道连续滑行——没有叠字。这里对齐该行为:去掉预览 卡片的 `Transition`,内容即换即走,`translateY` 滑行保留。 随之删除只为「两张卡不叠行」服务的 `grid-area: 1 / 1` 钉格(#238 引入,交叉淡入 淡出消失后该约束已无对象)、`preview-motion` 的 enter/leave 样式、reduced-motion 对应项,以及 pin 该钉格的主题测试。
commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
🤔 本次变更属于 ...
🔗 相关 Issue
💡 背景与方案
问题:
MessageScroller开启navigation="rail"后,悬停 / 触屏 / 聚焦切换刻度时,预览浮层的文案出现重影——半透明的新卡片透出旧文案,两个标题同时可读。根因:预览卡片用
<Transition>默认模式做交叉淡入淡出,新旧两张卡片在切换期间同帧共存,且都钉在预览轨道同一个网格单元里(#238 的钉格正是为此服务),位置完全重合。方案:逐帧实测参考实现 beUI MessageScroller 的 rail 行为后对齐之——全程只有一张卡片,文案在一帧内直接落到新激活项,卡片位置由轨道
transform连续滑行,没有叠字。因此:message-scroller/index.tsx:去掉预览卡片的<Transition>(及随行的key),内容即换即走;translateY滑行保持不变。message-scroller/style/index.ts:删除preview-motion的 enter/leave/active 规则、reduced-motion 对应项、只为「两张卡不叠行」存在的grid-area: 1 / 1钉格,以及不再使用的previewMotionCls与FOLLOW_MOTION_EASEimport。tests/theme.test.ts:删除 pin 网格单元的主题测试——它存在的唯一理由(交叉淡入淡出会叠行)已消失。验证(浏览器 rAF 逐帧实测,修复前 / 后同场景对比):
vp test packages/x-pro148/148 通过;vue-tsc --project tsconfig.build.json无错。jsdom 中Transition被 test-utils stub,叠字这类纯视觉缺陷无法用单测固化,故以上为浏览器实测证据。📝 变更日志