Skip to content

Commit 07389fd

Browse files
jimfbzpao
authored andcommitted
Fix autofocus for input and textarea (#6986)
(cherry picked from commit eb705d1)
1 parent 7a4aef0 commit 07389fd

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/renderers/dom/shared/ReactDOMComponent.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,14 +654,25 @@ ReactDOMComponent.Mixin = {
654654
inputPostMount,
655655
this
656656
);
657+
if (props.autoFocus) {
658+
transaction.getReactMountReady().enqueue(
659+
AutoFocusUtils.focusDOMComponent,
660+
this
661+
);
662+
}
657663
break;
658664
case 'textarea':
659665
transaction.getReactMountReady().enqueue(
660666
textareaPostMount,
661667
this
662668
);
669+
if (props.autoFocus) {
670+
transaction.getReactMountReady().enqueue(
671+
AutoFocusUtils.focusDOMComponent,
672+
this
673+
);
674+
}
663675
break;
664-
case 'button':
665676
case 'select':
666677
if (props.autoFocus) {
667678
transaction.getReactMountReady().enqueue(
@@ -670,6 +681,14 @@ ReactDOMComponent.Mixin = {
670681
);
671682
}
672683
break;
684+
case 'button':
685+
if (props.autoFocus) {
686+
transaction.getReactMountReady().enqueue(
687+
AutoFocusUtils.focusDOMComponent,
688+
this
689+
);
690+
}
691+
break;
673692
case 'option':
674693
transaction.getReactMountReady().enqueue(
675694
optionPostMount,

0 commit comments

Comments
 (0)