diff --git a/components/modal/ConfirmDialog.tsx b/components/modal/ConfirmDialog.tsx index b582b4fe41..54dfa50f70 100644 --- a/components/modal/ConfirmDialog.tsx +++ b/components/modal/ConfirmDialog.tsx @@ -36,6 +36,7 @@ const ConfirmDialog = (props: ConfirmDialogProps) => { closable = false, closeIcon, modalRender, + focusTriggerAfterClose, } = props; devWarning( @@ -101,6 +102,7 @@ const ConfirmDialog = (props: ConfirmDialogProps) => { closable={closable} closeIcon={closeIcon} modalRender={modalRender} + focusTriggerAfterClose={focusTriggerAfterClose} >
diff --git a/components/modal/Modal.tsx b/components/modal/Modal.tsx index e9212b4bf2..5b12e8aa6d 100644 --- a/components/modal/Modal.tsx +++ b/components/modal/Modal.tsx @@ -81,6 +81,7 @@ export interface ModalProps { prefixCls?: string; closeIcon?: React.ReactNode; modalRender?: (node: React.ReactNode) => React.ReactNode; + focusTriggerAfterClose?: boolean; } type getContainerFunc = () => HTMLElement; @@ -119,6 +120,7 @@ export interface ModalFuncProps { bodyStyle?: React.CSSProperties; closeIcon?: React.ReactNode; modalRender?: (node: React.ReactNode) => React.ReactNode; + focusTriggerAfterClose?: boolean; } export interface ModalLocale { @@ -177,6 +179,7 @@ const Modal: ModalInterface = props => { centered, getContainer, closeIcon, + focusTriggerAfterClose = true, ...restProps } = props; @@ -208,6 +211,7 @@ const Modal: ModalInterface = props => { mousePosition={mousePosition} onClose={handleCancel} closeIcon={closeIconToRender} + focusTriggerAfterClose={focusTriggerAfterClose} /> ); }; diff --git a/components/modal/index.en-US.md b/components/modal/index.en-US.md index 001f30b08a..227aad999d 100644 --- a/components/modal/index.en-US.md +++ b/components/modal/index.en-US.md @@ -26,6 +26,7 @@ When requiring users to interact with the application, but without jumping to a | destroyOnClose | Whether to unmount child components on onClose | boolean | false | | | footer | Footer content, set as `footer={null}` when you don't need default buttons | ReactNode | (OK and Cancel buttons) | | | forceRender | Force render Modal | boolean | false | | +| focusTriggerAfterClose | Whether need to focus trigger element after dialog is closed | boolean | true | 4.9.0 | | getContainer | Return the mount node for Modal | HTMLElement \| () => HTMLElement \| Selectors \| false | document.body | | | keyboard | Whether support press esc to close | boolean | true | | | mask | Whether show mask or not | boolean | true | | diff --git a/components/modal/index.zh-CN.md b/components/modal/index.zh-CN.md index e29ecc169f..9885f1e0a2 100644 --- a/components/modal/index.zh-CN.md +++ b/components/modal/index.zh-CN.md @@ -29,6 +29,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/3StSdUlSH/Modal.svg | destroyOnClose | 关闭时销毁 Modal 里的子元素 | boolean | false | | | footer | 底部内容,当不需要默认底部按钮时,可以设为 `footer={null}` | ReactNode | (确定取消按钮) | | | forceRender | 强制渲染 Modal | boolean | false | | +| focusTriggerAfterClose | 对话框关闭后是否需要聚焦触发元素 | boolean | true | 4.9.0 | | getContainer | 指定 Modal 挂载的 HTML 节点, false 为挂载在当前 dom | HTMLElement \| () => HTMLElement \| Selectors \| false | document.body | | | keyboard | 是否支持键盘 esc 关闭 | boolean | true | | | mask | 是否展示遮罩 | boolean | true | |