added support for creating tags with space or enter keys

This commit is contained in:
Pramod Mahajan 2025-05-26 13:33:18 +05:30
parent 7ff4280b4d
commit 35ca496166

View File

@ -60,7 +60,7 @@ useEffect(() => {
};
const handleInputKeyDown = (e) => {
if (e.key === "Enter" && input.trim() !== "") {
if ((e.key === "Enter" || e.key === " ") || trimmedInput !== "") {
e.preventDefault();
const existing = options.find(
(opt) => opt.name.toLowerCase() === input.trim().toLowerCase()