Closed timwis closed 7 years ago
GreenJello in freenode's #javascript suggested:
So there's a hidden <input>
. When they select a cell, I set focus to that input and start listening to the input event. When the input event is triggered, I activate "edit mode" on that cell and apply the value of that <input>
(what they started typing) to that cell. As opposed to listening to the onkeypress event and determining.
a hidden bonus of that is that it would enable copy & paste :O
This is a feature your muscle memory will expect from using a spreadsheet, especially when encountering an empty cell. Arrow-key navigate to a cell, then start typing to replace its contents. Rather than having to hit enter and then select-all.
Edit: This is a tough one.. beyond listening only to character keys (A-Z, 0-9, @#@, etc. rather than left/right/tab), we actually want to insert what you typed, as if you had been editing in the first place.