Skip to content

Commit

Permalink
Fix autofocus for input and textarea (#6986)
Browse files Browse the repository at this point in the history
(cherry picked from commit eb705d1)
  • Loading branch information
jimfb authored and zpao committed Jun 14, 2016
1 parent 7a4aef0 commit 07389fd
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/renderers/dom/shared/ReactDOMComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -654,14 +654,25 @@ ReactDOMComponent.Mixin = {
inputPostMount,
this
);
if (props.autoFocus) {
transaction.getReactMountReady().enqueue(
AutoFocusUtils.focusDOMComponent,
this
);
}
break;
case 'textarea':
transaction.getReactMountReady().enqueue(
textareaPostMount,
this
);
if (props.autoFocus) {
transaction.getReactMountReady().enqueue(
AutoFocusUtils.focusDOMComponent,
this
);
}
break;
case 'button':
case 'select':
if (props.autoFocus) {
transaction.getReactMountReady().enqueue(
Expand All @@ -670,6 +681,14 @@ ReactDOMComponent.Mixin = {
);
}
break;
case 'button':
if (props.autoFocus) {
transaction.getReactMountReady().enqueue(
AutoFocusUtils.focusDOMComponent,
this
);
}
break;
case 'option':
transaction.getReactMountReady().enqueue(
optionPostMount,
Expand Down

0 comments on commit 07389fd

Please sign in to comment.