diff --git a/frontend/src/lib/components/Dropdown/dropdown.tsx b/frontend/src/lib/components/Dropdown/dropdown.tsx index 6cdb4dfe1..870f38617 100644 --- a/frontend/src/lib/components/Dropdown/dropdown.tsx +++ b/frontend/src/lib/components/Dropdown/dropdown.tsx @@ -166,14 +166,7 @@ export const Dropdown = withDefaults()(defaultProps, (props) => { setOptionIndexWithFocusToCurrentSelection(); } } - }, [ - inputBoundingRect, - dropdownVisible, - filteredOptions, - selection, - setOptionIndexWithFocusToCurrentSelection, - setStartIndex, - ]); + }, [inputBoundingRect, dropdownVisible, filteredOptions, selection]); const handleOptionClick = React.useCallback( (value: string) => { diff --git a/frontend/src/lib/hooks/useElementBoundingRect.ts b/frontend/src/lib/hooks/useElementBoundingRect.ts index fa3604654..916e13b60 100644 --- a/frontend/src/lib/hooks/useElementBoundingRect.ts +++ b/frontend/src/lib/hooks/useElementBoundingRect.ts @@ -13,6 +13,7 @@ export function useElementBoundingRect(ref: React.RefObject): DOMRe const resizeObserver = new ResizeObserver(handleResize); window.addEventListener("resize", handleResize); + window.addEventListener("scroll", handleResize, true); if (ref.current) { handleResize(); @@ -22,6 +23,7 @@ export function useElementBoundingRect(ref: React.RefObject): DOMRe return () => { resizeObserver.disconnect(); window.removeEventListener("resize", handleResize); + window.removeEventListener("scroll", handleResize, true); }; }, [ref]);