Repository navigation
Conversation
lnuxe
requested review from
HaixingOoO,
NWYLZW,
RylanBot,
ZWkang,
carolin913,
honkinglin and
uyarn
as code owners
November 12, 2026 10:02
Closing a modal queues the lock-style removal on a 150ms timer. Reopening within that window appended the style again but left the old timer running, so it fired afterwards and removed the style the open dialog was using - the background page became scrollable while the dialog was still up. Clear the pending timer before re-appending. Verified: - new test fails on the previous implementation (expected +0 to be 1) - new test passes with the fix - dialog: 12 tests pass
lnuxe
force-pushed
the
fix/dialog-lock-style-reopen
branch
from
November 13, 2026 03:05
07b793b to
acc6e41
Compare
Collaborator
TDesign Component Site Preview Open
|
commit: |
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.

🤔 这个 PR 的性质是?
🔗 相关 Issue
无(本 PR 直接修复 Dialog 快速重开时的滚动穿透)
📝 描述
useLockStyle在 Dialog 关闭后延迟 150ms 才移除滚动锁样式,这样离场动画不会被截断。但重新打开时只做了appendChild,没有取消上一次排队的移除:所以「关闭 → 150ms 内重新打开」时,旧定时器到点会把正在使用的锁样式摘掉,页面在弹窗打开的状态下可以滚动——滚动穿透。
改动
if (visible) { + // 重新打开时取消上一次关闭排队的移除,否则 150ms 后会把正在使用的锁样式删掉 + clearTimeout(timerRef.current); document.head.appendChild(lockStyleRef.current); } else { clearStyleFunc(); }🔍 自测
修复前(还原
useLockStyle.ts后跑新测试):修复后:
第二个用例确认正常关闭路径仍然会移除锁样式,修复没有把清理一起关掉。
回归:
✅ 贡献者检查