diff --git a/src/numeric_format.tsx b/src/numeric_format.tsx index e96cffb1..ac42d107 100644 --- a/src/numeric_format.tsx +++ b/src/numeric_format.tsx @@ -408,6 +408,12 @@ export function useNumericFormat( const { key } = e; const { selectionStart, selectionEnd, value = '' } = el; + // if the input has only negation, allow the user to delete it + if (key === 'Backspace' && value === '-') { + onKeyDown(e); + return; + } + // if user tries to delete partial prefix then ignore it if ((key === 'Backspace' || key === 'Delete') && selectionEnd < prefix.length) { e.preventDefault();