glide-data-grid
glide-data-grid copied to clipboard
Keep focus in overlay editor
Tries to fix #910
- if an editor is a native html input or textarea, we use
readOnlyinstead of disabled; this allows the element to be focus-able but not editable. Benefit of this is that selection still works if a person wants to copy the cell content. - for editors without a focusable element (and also editors in general), instead of using an invisible textarea with autofocus=true, we make the overlay editor focusable itself and autofocused on mount; shouldn't conflict with editors with autofocused elements since children renders after parent
We should add some tests to check that click within cell and then pressing escape works for each internal cell editor.
I think this looks fine. But also a bit risky since it touches a very important part. I will try to do another iteration and check it out locally + read a bit about potential downsides.
Not a blocker for me; it is important that we find a way to always maintain focus if user is interacting with the grid, and not have it be lost unexpectedly to body. There can be other alternatives to this PR as well.