Skip to content

Commit 8e77a98

Browse files
feat: enable tab key to highlight first suggestion in class autocomplete
1 parent 9140cc5 commit 8e77a98

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/core/components/settings/new-panel/manual-classes.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,17 @@ export function ManualClasses() {
165165
e.preventDefault();
166166
addNewClasses();
167167
}
168+
if (e.key === "Tab" && suggestions.length > 0) {
169+
e.preventDefault();
170+
// Simulate ArrowDown to highlight
171+
const downEvent = new KeyboardEvent("keydown", {
172+
key: "ArrowDown",
173+
code: "ArrowDown",
174+
keyCode: 40,
175+
bubbles: true,
176+
});
177+
e.target.dispatchEvent(downEvent);
178+
}
168179
},
169180
onChange: (_e: any, { newValue }: any) => setNewCls(newValue),
170181
className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1",

0 commit comments

Comments
 (0)