segmentio / evergreen

🌲 Evergreen React UI Framework by Segment
https://evergreen.segment.com
MIT License
12.39k stars 832 forks source link

Pressing `esc` while focused on `TagInput` component throws error #1472

Closed brandongregoryscott closed 2 years ago

brandongregoryscott commented 2 years ago

Steps to reproduce:

  1. Click or tab into an enabled TagInput component, such as the ones on the doc site https://evergreen.segment.com/components/tag-input
  2. Press the esc key, and you should get the following runtime error: TypeError: Cannot read properties of null (reading 'split')

image

At a first glance, it seems like pressing esc is setting the internal inputValue (which is expected to be a string) to null, which breaks the string-splitting behavior for generating the tag list.

pandurijal commented 2 years ago

what is the expected behavior for this case? just simply don't throw an error when the user clicks ESC or?

pandurijal commented 2 years ago

I believe I already found the workaround for this. Can you please assign this task to me?

brandongregoryscott commented 2 years ago

@pandurijal I think the esc should basically be swallowed, the same behavior as our standard TextInput or Textarea components

pandurijal commented 2 years ago

sure @brandongregoryscott I already opened a PR for this issue