Skip to content

Commit 6ff3954

Browse files
shaodahongafc163
authored andcommitted
rename focusTriggerAfterClose
1 parent 9454804 commit 6ff3954

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,10 @@ ReactDOM.render(
210210
<td>Create dialog dom node before dialog first show </td>
211211
</tr>
212212
<tr>
213-
<td>disableFocus</td>
213+
<td>focusTriggerAfterClose</td>
214214
<td>Boolean</td>
215-
<td>false</td>
216-
<td>Disable focus target element when invisible</td>
215+
<td>true</td>
216+
<td>focus trigger element when dialog closed</td>
217217
</tr>
218218
</tbody>
219219
</table>

examples/ant-design.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class MyControl extends React.Component<any, any> {
112112
destroyOnClose={this.state.destroyOnClose}
113113
closeIcon={this.state.useIcon ? getSvg(clearPath, {}, true) : undefined}
114114
forceRender={this.state.forceRender}
115-
disableFocus
115+
focusTriggerAfterClose={false}
116116
>
117117
<input autoFocus />
118118
<p>basic modal</p>

src/Dialog.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ export default class Dialog extends React.Component<IDialogChildProps, any> {
6868
maskClosable: true,
6969
destroyOnClose: false,
7070
prefixCls: 'rc-dialog',
71+
focusTriggerAfterClose: true,
7172
};
7273

7374
private inTransition: boolean = false;
@@ -98,7 +99,7 @@ export default class Dialog extends React.Component<IDialogChildProps, any> {
9899
}
99100

100101
componentDidUpdate(prevProps: IDialogPropTypes) {
101-
const {visible, mask, disableFocus} = this.props;
102+
const {visible, mask, focusTriggerAfterClose} = this.props;
102103
const mousePosition = this.props.mousePosition;
103104
if (visible) {
104105
// first show
@@ -119,7 +120,7 @@ export default class Dialog extends React.Component<IDialogChildProps, any> {
119120
}
120121
} else if (prevProps.visible) {
121122
this.inTransition = true;
122-
if (mask && this.lastOutSideFocusNode && !disableFocus) {
123+
if (mask && this.lastOutSideFocusNode && focusTriggerAfterClose) {
123124
try {
124125
this.lastOutSideFocusNode.focus();
125126
} catch (e) {

src/IDialogPropTypes.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ interface IDialogPropTypes {
4040
forceRender?: boolean;
4141
// https://github.com/ant-design/ant-design/issues/19771
4242
// https://github.com/react-component/dialog/issues/95
43-
disableFocus?: boolean;
43+
focusTriggerAfterClose?: boolean;
4444
}
4545

4646
export default IDialogPropTypes;

0 commit comments

Comments
 (0)