Skip to content

Commit 0afec13

Browse files
authored
Merge pull request #444 from nianxiongdi/a11yd
docs(Dialog): fix focus problem
2 parents a0f7a58 + 8a1dadc commit 0afec13

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

docs/dialog/demo/accessibility.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ class Demo extends React.Component {
2828
visible: true
2929
});
3030
};
31-
onClose = reason => {
32-
console.log(reason);
33-
31+
onClose = () => {
3432
this.setState({
3533
visible: false
3634
});
@@ -44,6 +42,7 @@ class Demo extends React.Component {
4442
<Dialog
4543
title="Welcome to Alibaba.com"
4644
visible={this.state.visible}
45+
autoFocus
4746
onOk={this.onClose.bind(this, 'okClick')}
4847
onCancel={this.onClose.bind(this, 'cancelClick')}
4948
onClose={this.onClose}

docs/overlay/demo/accessibility.md

+4-7
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,20 @@ import { Overlay } from '@alifd/next';
2121
class Demo extends React.Component {
2222
constructor(props) {
2323
super(props);
24-
2524
this.state = {
2625
visible: false
2726
};
28-
}
29-
27+
};
3028
onClick = () => {
3129
this.setState({
3230
visible: !this.state.visible
3331
});
34-
}
35-
32+
};
3633
onClose = () => {
3734
this.setState({
3835
visible: false
3936
});
40-
}
41-
37+
};
4238
render() {
4339
return (
4440
<div>
@@ -48,6 +44,7 @@ class Demo extends React.Component {
4844
overlay accessibility
4945
</button>
5046
<Overlay visible={this.state.visible}
47+
autoFocus
5148
target={() => this.btn}
5249
safeNode={() => this.btn}
5350
onRequestClose={this.onClose}>

0 commit comments

Comments
 (0)