Skip to content

Commit 8d067ed

Browse files
committed
fix(test): guard scrollIntoView call for JSDOM compatibility
JSDOM doesn't implement scrollIntoView, causing tests to fail in CI.
1 parent 4c56afd commit 8d067ed

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/hooks/use-listbox-keyboard.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export function useListboxKeyboard<T>({
7878

7979
const optionId = getOptionId(focusedIndex)
8080
const element = document.querySelector(`#${CSS.escape(optionId)}`)
81-
if (element) {
81+
if (element && typeof element.scrollIntoView === 'function') {
8282
element.scrollIntoView({ block: 'nearest' })
8383
}
8484
}, [isOpen, focusedIndex, getOptionId])

0 commit comments

Comments
 (0)