Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/components/dialog/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ const Dialog = forwardRef<DialogInstance, DialogProps>((originalProps, ref) => {

const { focusTopDialog } = useDialogEsc(visible, wrapRef);
useLockStyle({ preventScrollThrough, visible, mode, showInAttachedElement });
useDialogEsc(visible, wrapRef);
useDialogPosition(visible, dialogCardRef);
const { isInputInteracting } = useDialogDrag({
dialogCardRef,
Expand Down
14 changes: 5 additions & 9 deletions packages/components/drawer/Drawer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { forwardRef, isValidElement, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
import React, { forwardRef, isValidElement, useImperativeHandle, useMemo, useRef, useState } from 'react';
import { CSSTransition } from 'react-transition-group';
import { CloseIcon as TdCloseIcon } from 'tdesign-icons-react';
import classnames from 'classnames';
Expand Down Expand Up @@ -103,13 +103,6 @@ const Drawer = forwardRef<DrawerInstance, DrawerProps>((originalProps, ref) => {
},
}));

useEffect(() => {
if (visible) {
// 聚焦到 Drawer 最外层元素即 containerRef.current,KeyDown 事件才有效。
containerRef.current?.focus?.();
}
}, [visible]);

useDeepEffect(() => {
// 非插件式调用 更新props
if (isPlugin) return;
Expand Down Expand Up @@ -220,7 +213,10 @@ const Drawer = forwardRef<DrawerInstance, DrawerProps>((originalProps, ref) => {
unmountOnExit={destroyOnClose}
timeout={{ appear: 10, enter: 10, exit: 300 }}
onEnter={() => onBeforeOpen?.()}
onEntered={() => setAnimationStart(true)}
onEntered={() => {
setAnimationStart(true);
containerRef.current?.focus?.();
}}
onExit={() => onBeforeClose?.()}
onExited={() => setAnimationStart(false)}
>
Expand Down
Loading