-
Notifications
You must be signed in to change notification settings - Fork 366
Description
Hi, I've been trying out your library recently and it's been working very well.
After migrating my project from react to preact using preact/compat, everything seems to work except when editing the number input, I occasionally get:
Uncaught TypeError: Cannot read properties of undefined (reading 'setSelectionRange') which is here:
onFocus: (e3) => e3.target.setSelectionRange(highlight ? 0 : e3.target.value.length, e3.target.value.length)which seems to be here:
Line 61 in f1a7c9b
| e.target.setSelectionRange(highlight ? 0 : e.target.value.length, e.target.value.length) |
I suspect this has to do with the fact that preact uses the regular dom events vs reacts synthetic events (see: https://preactjs.com/guide/v10/differences-to-react/#main-differences).
I expect that using e.currentTarget here (and in other places where you use e.target) will resolve this issue. This should work with react as well and would make this project fully compatible with preact/compat.
Would you be open to updating this?