Open plocket opened 1 year ago
We might look into setting the value or pasting the text and then typing ' '
to make sure the user has interacted with the field. This would also speed up writing a lot of text in a textarea
. Here's one example of setting the value, etc. There's a more recent one that may do a better job.
cucumberjs stringifies the value before passing it in to us. We can't
JSON.parse()
the value, because parsing\\n
will cause an error ("hello\nworld"
isn't a valid JSON value). We can simply replace\\n
and\\r
with\n
and\r
. It's not a complete unescape solution, but the more complete solution is problematic. For example, we could put it in an array first:It's just not particularly safe. If users do something like "hello\nworld\" they'll get an error that's completely useless while if we just deal with new lines ourselves, they shouldn't run into that problem. The problems they would run into would then be more visible and easier to fix than if we try to be clever about it.
imo, we should replace only escaped newline characters like
\\n
and\\r
when we type into a textarea.