react-currency-input icon indicating copy to clipboard operation
react-currency-input copied to clipboard

Getting error message when using number input

Open hdotson1 opened this issue 8 years ago • 6 comments

I am getting the following error when trying to use a numeric input.

Uncaught DOMException: Failed to execute 'setSelectionRange' on 'HTMLInputElement': The input element's type ('number') does not support selection.

My component call looks like this:

<CurrencyInput
  name="customerAllocationMicros"
  allowNegative
  value={(line.customerAllocationMicros / 1000)}
  onChangeEvent={this.updateAllocationLine(index)}
  disabled={disableControls}
/>

line is part of an array in my state, and updateAllocationLine takes the index to that array and returns a function that will update the correct array member via setState.

Any ideas?

hdotson1 avatar Jul 27 '17 21:07 hdotson1

This is interesting since you're not defining inputType. Can you post a small repo that reproduces the error? That would help me debug this.

aesopwolf avatar Jul 31 '17 18:07 aesopwolf

Hi, any solution?

eseQ avatar May 20 '19 11:05 eseQ

simple reproduce

eseQ avatar May 20 '19 11:05 eseQ

Thanks for the reproduction @eseQ. Unfortunately, I haven't used this project in quite some time. If you're able to open a pull request to fix the issue then I can approve it and merge it in, but I won't be able to spend the time to fix the issue myself.

aesopwolf avatar May 20 '19 15:05 aesopwolf

@aesopwolf thanks for the answer. Maybe I can fix it later.

eseQ avatar May 21 '19 06:05 eseQ

fwiw, number type does not support selection, so specifying inputType to text or tel should work.

ericblade avatar Jan 04 '22 00:01 ericblade