diff --git a/src/tag/Tag.tsx b/src/tag/Tag.tsx index 26f6ff18..ff8e3328 100644 --- a/src/tag/Tag.tsx +++ b/src/tag/Tag.tsx @@ -1,12 +1,11 @@ +import "./_tag.scss"; + import CloseIcon from "../ui/icons/close.svg"; import React from "react"; import classNames from "classnames"; -import Button from "../button/Button"; - -// SCSS import is moved here to override Button styles without nesting -import "./_tag.scss"; +import {KEYBOARD_EVENT_KEY} from "../core/utils/keyboard/keyboardEventConstants"; export interface TagShape { id: string; @@ -27,11 +26,13 @@ function Tag({testid, tag, onRemove, customClassName}: TagProps) { }); return ( - + ); function handleRemove() { @@ -49,6 +50,20 @@ function Tag({testid, tag, onRemove, customClassName}: TagProps) { onRemove(tag); } } + + function handleKeyPress(event: React.KeyboardEvent) { + event.stopPropagation(); + + switch (event.key) { + case KEYBOARD_EVENT_KEY.ENTER: + case KEYBOARD_EVENT_KEY.BACKSPACE: + handleRemove(); + break; + + default: + break; + } + } } export default Tag; diff --git a/src/tag/_tag.scss b/src/tag/_tag.scss index 3342697e..d219527b 100644 --- a/src/tag/_tag.scss +++ b/src/tag/_tag.scss @@ -23,6 +23,8 @@ } .tag--is-removable { + cursor: pointer; + &:hover { path { stroke: var(--text-color);