diff --git a/CHANGELOG.md b/CHANGELOG.md index 7bdd3a9..f435500 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Added additional UI tests for Dropdown, Input and MultiSelect - Added className props for Input UI component - Fixed SVG arrow icon color for MultiSelect and Dropdown +- Fixed Multiselect and Dropdown backspace keyboard event ## 1.3.0 diff --git a/src/components/dropdown/Dropdown.tsx b/src/components/dropdown/Dropdown.tsx index 163a066..e144202 100644 --- a/src/components/dropdown/Dropdown.tsx +++ b/src/components/dropdown/Dropdown.tsx @@ -115,6 +115,10 @@ const Dropdown = ({ } if ((event.key === 'Backspace' || event.key === 'Delete') && selectedOption?.key) { + if (search !== '') { + return + } + setSearch(selectedOption?.value) setSelectedOption(undefined) onSelect?.(undefined) diff --git a/src/components/input/Input.tsx b/src/components/input/Input.tsx index a0c7aab..bf960b5 100644 --- a/src/components/input/Input.tsx +++ b/src/components/input/Input.tsx @@ -8,15 +8,18 @@ import styles from './styles.module.sass' * InputProps interface, representing the properties for the Input component. */ export interface InputProps extends React.InputHTMLAttributes { + /** Additional class names for custom styling */ + className?: string /** Label text displayed above the input field */ label?: string /** Error message displayed below the input field when an error occurs */ error?: string } -const Input: React.FC = ({ label, error, ...props }) => ( +const Input: React.FC = ({ className, label, error, ...props }) => (
({ } if (event.key === 'Backspace' || event.key === 'Delete') { + if (search !== '') { + return + } + const selected = [...(selectedOption || [])] selected.pop()