Scope tag input query selector

This commit is contained in:
Sam Becker 2024-02-05 19:37:07 -06:00
parent e330330147
commit e5efc3614d

View File

@ -89,7 +89,7 @@ export default function TagInput({
// Focus option in the DOM when selected index changes
useEffect(() => {
if (selectedOptionIndex !== undefined) {
const options = optionsRef.current?.querySelectorAll('div');
const options = optionsRef.current?.querySelectorAll(':scope > div');
const option = options?.[selectedOptionIndex] as HTMLElement | undefined;
option?.focus();
}