fix(deps): 模态表单里 lookup 搜索框聚焦即被夺回——补丁修复 focus-scope 栈驱逐竞态 (#3183) - #3184
Closed
baozhoutao wants to merge 1 commit into
Closed
fix(deps): 模态表单里 lookup 搜索框聚焦即被夺回——补丁修复 focus-scope 栈驱逐竞态 (#3183)#3184baozhoutao wants to merge 1 commit into
baozhoutao wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
产线 console 里,新建/编辑模态中 lookup 快捷下拉的搜索框和 Record Picker
表格弹窗都无法输入:焦点在 focusout 阶段就被外层 Dialog 的 FocusScope
同步拽回触发按钮,列表永不过滤("新建记录时 lookup 无法搜索")。
根因是 @radix-ui/react-focus-scope@1.1.16(上游最新 rc 同样存在)的竞态:
栈管理 effect 的 cleanup 用 setTimeout(0) 延迟执行
focusScopesStack.remove(scope)。当该 effect 因 container ref 抖动在组件
未卸载时重跑,顺序变成"重跑先 add → 旧 cleanup 的延时 remove 后执行",
刚加回去的 scope 被永久踢出栈——dialog 的陷阱监听器还活着,却再也没有
弹层能 pause 它。vite dev 不触发该抖动,所以只有产线 bundle 复现。
pnpm patch:effect 重跑(scope 存活)时取消挂起的延时驱逐;真实卸载路径
(autofocus-on-unmount + 栈移除)不变。回归测试用 asChild 子元素换 key
确定性复现竞态:未打补丁必红。已在 rc.1 后端 + 修复后产线 console 真机
验证下拉与表格弹窗搜索均恢复。
Closes #3183
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
os-zhuang
enabled auto-merge
August 2, 2026 07:49
os-zhuang
disabled auto-merge
August 2, 2026 07:49
Contributor
|
已 重新开发并合并 |
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.
问题
产线构建的 console(如
@objectstack/console@17.0.0-rc.1)中,新建/编辑记录的模态表单里 lookup 字段无法搜索:仅产线 bundle 复现,
vite dev(HMR)正常,因此现有测试与日常开发均未暴露。Closes #3183。根因
@radix-ui/react-focus-scope@1.1.16(上游最新 rc 同样存在)的栈驱逐竞态:setTimeout(0)延迟执行focusScopesStack.remove(scope);add→ 旧 cleanup 的延时remove后执行」,刚加回去的 scope 被永久踢出栈;pause它 → 弹层内输入框的焦点永远被同步夺回。排查过程(服务端排除、浏览器插桩、fiber 状态挖掘)详见 #3183。
修复
pnpm patch(patches/@radix-ui__react-focus-scope.patch):clearTimeout取消上一次 cleanup 挂起的延时驱逐;验证
packages/components/src/__tests__/dialog-popover-focus-scope.test.tsx:用「asChild 子元素换 key → container ref 重挂 → effect 必然重跑」确定性复现竞态,未打补丁必红、打补丁转绿(已双向验证);另附 Dialog+Popover 集成用例与陷阱恢复用例。zzz→「未找到选项」、Dev→正确过滤;Record Picker 弹窗搜索恢复;showcase 后端 + 修复版产线构建同样验证通过。备注
@object-ui/components的第三方需等上游修复。🤖 Generated with Claude Code