浏览代码

Prevent default on Chips

Tatiana Inama 6 年之前
父节点
当前提交
bf453f233f
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      recipes/src/components/TagInput/index.tsx

+ 1 - 0
recipes/src/components/TagInput/index.tsx

@@ -30,6 +30,7 @@ export const TagInput:FunctionComponent<TagInputProps> = ({ label, onNewTag, tag
   const handleKeyDown = (e: any) => {
     const label = e.target.value;
     if (!!label && e.key === 'Enter') {
+      e.preventDefault();
       updateTags(uniq([...tags, label]));
     }
   }