Skip to content

Commit

Permalink
Use currentTarget
Browse files Browse the repository at this point in the history
  • Loading branch information
sarayourfriend committed Aug 2, 2021
1 parent fa1d387 commit d736b46
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/components/src/input-control/input-field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function InputField(
};

const handleOnCommit = ( event: SyntheticEvent< HTMLInputElement > ) => {
const nextValue = ( event.target as HTMLInputElement ).value;
const nextValue = event.currentTarget.value;

try {
onValidate( nextValue, event );
Expand Down Expand Up @@ -210,10 +210,9 @@ function InputField(
handleOnMouseDown = ( event: MouseEvent< HTMLInputElement > ) => {
props.onMouseDown?.( event );
if (
event.target !==
( event.target as HTMLInputElement ).ownerDocument.activeElement
event.target !== event.currentTarget.ownerDocument.activeElement
) {
( event.target as HTMLInputElement ).focus();
event.currentTarget.focus();
}
};
}
Expand Down

0 comments on commit d736b46

Please sign in to comment.