Skip to content

Commit 6338fc3

Browse files
miguelc1221eddywashere
authored andcommitted
feat(Modal): add autoFocus prop for disabling auto focus (reactstrap#389)
* fix(Modal): Made focus optional * set default focus to true * rename prop to autoFocus
1 parent a4fec3c commit 6338fc3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Modal.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313

1414
const propTypes = {
1515
isOpen: PropTypes.bool,
16+
autoFocus: PropTypes.bool,
1617
size: PropTypes.string,
1718
toggle: PropTypes.func,
1819
keyboard: PropTypes.bool,
@@ -46,6 +47,7 @@ const propTypes = {
4647

4748
const defaultProps = {
4849
isOpen: false,
50+
autoFocus: true,
4951
backdrop: true,
5052
keyboard: true,
5153
zIndex: 1050,
@@ -127,7 +129,9 @@ class Modal extends React.Component {
127129

128130
togglePortal() {
129131
if (this.props.isOpen) {
130-
this._focus = true;
132+
if (this.props.autoFocus) {
133+
this._focus = true;
134+
}
131135
this.show();
132136
if (!this.hasTransition()) {
133137
this.onEnter();

0 commit comments

Comments
 (0)