diff --git a/assets/apps/components/src/Common/SingleSizingInput.js b/assets/apps/components/src/Common/SingleSizingInput.js index f119fa1e64..2da051f193 100755 --- a/assets/apps/components/src/Common/SingleSizingInput.js +++ b/assets/apps/components/src/Common/SingleSizingInput.js @@ -1,4 +1,5 @@ import PropTypes from 'prop-types'; +import { useState } from '@wordpress/element'; const SingleSizingInput = ({ type, @@ -10,6 +11,9 @@ const SingleSizingInput = ({ label, disabled, }) => { + // Partial input like "-" reads as empty; rendering 0 would erase it. + const [isEmptyInput, setIsEmptyInput] = useState(false); + return (
- onChange(type, e.target.value === '' ? 0 : e.target.value) - } + onChange={(e) => { + setIsEmptyInput(e.target.value === ''); + onChange(type, e.target.value === '' ? 0 : e.target.value); + }} + onBlur={() => setIsEmptyInput(false)} /> {label && (