mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 02:59:58 +08:00
feat: add a focusTriggerAfterClose prop to Modal for passing down to rc-dialog (#27985)
* Add a focusTriggerAfterClose prop to Modal for passing down to rc-dialog - set default value to true, similarly to rc-dialog - add comments to the Modal docs. CN is google-translated though. * Add a version number to docs From code review suggestions Co-authored-by: 偏右 <afc163@gmail.com> Co-authored-by: Eugeny Molokov <eugeny.molokov@fastdev.se> Co-authored-by: 偏右 <afc163@gmail.com>
This commit is contained in:
parent
18c6d6fedb
commit
1852e7553e
@ -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}
|
||||
>
|
||||
<div className={`${contentPrefixCls}-body-wrapper`}>
|
||||
<ConfigProvider prefixCls={rootPrefixCls}>
|
||||
|
@ -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}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
@ -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 | |
|
||||
|
@ -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 | |
|
||||
|
Loading…
Reference in New Issue
Block a user