v0.3.7: 全面代码审计修复 - 20项Bug/安全/稳定性改进
This commit is contained in:
@@ -27,7 +27,10 @@ export const ConfirmDialog = React.memo(function ConfirmDialog({
|
||||
// 打开时保存焦点并聚焦确认按钮;关闭时恢复焦点
|
||||
useEffect(() => {
|
||||
if (!open) {
|
||||
previousFocusRef.current?.focus()
|
||||
// Only restore focus if the element is still in the DOM
|
||||
if (previousFocusRef.current && previousFocusRef.current.isConnected) {
|
||||
previousFocusRef.current.focus()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user