Skip to content
Prev Previous commit
Next Next commit
Use currentTarget
  • Loading branch information
sarayourfriend committed Aug 2, 2021
commit d736b4610d2b4a1d63b3ed179fe1696a2a84d725
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