C
Csaba Gabor
Is there a way to definitively know what (and whether any) character is
about to be plunked into a textarea based on keyboard input (from
keydown, keypress, keyup, or other events)?
Hint: this is a trick question.
But you can assume that the textarea has focus, and the focus isn't
changed (no alt+tab type of situations),
and that this is not a question about the clipboard (so we're not
worrying about ctrl+v, delete, backspace, and friends),
and that the entire chain of events is delivered (unlike printScreen or
ctrl+tab and friends).
Furthermore, "plunked into" means that textarea.value will change
(assuming there is no selection). That is to say, I'm really not
concerned with whether the user will see the character well rendered or
whether it's a tab character or a newline or something the rendering
engine doesn't know about.
To be concrete with an example, ctrl+a => "", since it's not a printing
character, and shift+a => "A", and if my keyboard maps ctrl+alt+o to
ó, then ctrl+alt+o => "ó".
Csaba Gabor from Vienna
about to be plunked into a textarea based on keyboard input (from
keydown, keypress, keyup, or other events)?
Hint: this is a trick question.
But you can assume that the textarea has focus, and the focus isn't
changed (no alt+tab type of situations),
and that this is not a question about the clipboard (so we're not
worrying about ctrl+v, delete, backspace, and friends),
and that the entire chain of events is delivered (unlike printScreen or
ctrl+tab and friends).
Furthermore, "plunked into" means that textarea.value will change
(assuming there is no selection). That is to say, I'm really not
concerned with whether the user will see the character well rendered or
whether it's a tab character or a newline or something the rendering
engine doesn't know about.
To be concrete with an example, ctrl+a => "", since it's not a printing
character, and shift+a => "A", and if my keyboard maps ctrl+alt+o to
ó, then ctrl+alt+o => "ó".
Csaba Gabor from Vienna