fix: Opening contextual menus sometimes change scroll position

This commit is contained in:
Tom Moor
2023-07-18 21:31:43 -04:00
parent eae6204d55
commit 3c6e2aaac6
3 changed files with 42 additions and 21 deletions

View File

@@ -85,11 +85,11 @@ const InputSelect = (props: Props) => {
const contentRef = React.useRef<HTMLDivElement>(null);
const minWidth = buttonRef.current?.offsetWidth || 0;
const margin = 8;
const menuMaxHeight = useMenuHeight(
select.visible,
select.unstable_disclosureRef,
margin
);
const menuMaxHeight = useMenuHeight({
visible: select.visible,
elementRef: select.unstable_disclosureRef,
margin,
});
const maxHeight = Math.min(
menuMaxHeight ?? 0,
window.innerHeight -