fix(recruit): FAQ accordion — keep every item visible when toggling open/close#16
Merged
Conversation
gh project field-edit 不能动 Priority 选项, 但 gh issue edit --add-project (把 issue 加到 Project v2 看板) 需要 read:project scope 才能看到已有的 project number. 不授权的话会报 'not found'. 把原 'gh auth refresh -s project' 改成 'project,read:project' 并加一行 注释提醒用户留意浏览器跳出的授权页.
className 是 `rf-item reveal${open ? ' rf-open' : ''}`, open 一切,
React 重新写 class attribute, 把 IntersectionObserver 通过
classList.add 加的 .in 一起冲掉. 结果是: 用户滚到 FAQ 区域点按钮,
被点的那条 + 之前 open 的那条 opacity 变成 0 (消失), 其他没动
className 的 3 条保持可见.
修法: 把 .in 从 DOM 操作改成 React state (seen: Set<number>),
纳入 JSX className. 现在 open 切换时 className 字符串始终包含
'in', React 不会再冲掉它.
e2e: 加了 'FAQ accordion: opening/closing keeps every item visible'
回归测试, 滚到 FAQ 等 5 项都 in + opacity > 0.95, 然后连续点 5 次,
每次点完断言所有 5 项仍然可见. 防止以后再有 className 覆盖冲 class
的坑悄悄回来.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Summary
opacity: 0)gh auth refresh需要read:projectscope 才能--add-projectRoot cause
<li className={\rf-item reveal${open ? ' rf-open' : ''}`}>里的rf-open会随 state 切换。.in是 IntersectionObserver 通过classList.add('in')手动加的。React 一旦发现 className 字符串变化,整个class属性会被覆盖写回——in` 一起被冲掉。所以:in保留?"rf-item reveal rf-open"→"rf-item reveal""rf-item reveal"→"rf-item reveal rf-open"结果:用户滚到 FAQ 点按钮时,open + 刚点的两条消失,其他 3 条保持可见。
Fix
把
.in从 DOM 操作改成 React state(seen: Set<number>),纳入 JSX className:seen由 IntersectionObserver 维护,setState 触发重新渲染,className 字符串始终带in,React 不会再冲掉它。Test
新增
e2e/desktop.spec.js回归测试 "FAQ accordion: opening/closing keeps every item visible":in + opacity > 0.95pnpm test:e2e全过:9 desktop + 12 mobile ✓Changes
Commits
444955ddocs(setup): note read:project scope requirement4b97a0efix(recruit): preserve .in class when FAQ accordion toggles open