Skip to content

Commit

Permalink
fix: synchronize focused email input on blur to avoid check validity …
Browse files Browse the repository at this point in the history
…when inputting
  • Loading branch information
jameslahm committed Aug 15, 2020
1 parent ffb749c commit 2ab42d8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/react-dom/src/client/ReactDOMInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ export function setDefaultValue(
) {
if (
// Focused number inputs synchronize on blur. See ChangeEventPlugin.js
type !== 'number' ||
(type !== 'number' && type !== 'email') ||
node.ownerDocument.activeElement !== node
) {
if (value == null) {
Expand Down
6 changes: 5 additions & 1 deletion packages/react-dom/src/events/plugins/ChangeEventPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,11 @@ function getTargetInstForInputOrChangeEvent(
function handleControlledInputBlur(node: HTMLInputElement) {
const state = (node: any)._wrapperState;

if (!state || !state.controlled || node.type !== 'number') {
if (
!state ||
!state.controlled ||
(node.type !== 'number' && node.type !== 'email')
) {
return;
}

Expand Down

0 comments on commit 2ab42d8

Please sign in to comment.