glideapps / glideapps/glide-data-grid
Use e.currentTarget instead of e.target for compatibility with preact/compat
- Dominant language
- TypeScript
- Stars
- 5.3k
- Forks
- 428
- PR merge metrics
- No merged PRs in 30d
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:
```js
onFocus: (e3) => e3.target.setSelectionRange(highlight ? 0 : e3.target.value.length, e3.target.value.length)
```
which seems to be here: https://github.com/glideapps/glide-data-grid/blob/f1a7c9bb97fb29898de74368e915e25e1117c49a/packages/core/src/internal/data-grid-overlay-editor/private/number-overlay-editor.tsx#L61
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?
Contributor guide
Assessment
This issue has not been assessed yet.