fix(ui): bound dropdowns during scroll
This commit is contained in:
@@ -41,6 +41,16 @@ export function createFloatingLayer({
|
||||
const reposition = () => {
|
||||
if (!openState) return;
|
||||
const anchor = trigger.getBoundingClientRect();
|
||||
const anchorVisible = (
|
||||
anchor.bottom > 0
|
||||
&& anchor.top < window.innerHeight
|
||||
&& anchor.right > 0
|
||||
&& anchor.left < window.innerWidth
|
||||
);
|
||||
if (!anchorVisible) {
|
||||
close();
|
||||
return;
|
||||
}
|
||||
const measured = surface.getBoundingClientRect();
|
||||
const surfaceWidth = Math.max(minWidth, matchTriggerWidth ? anchor.width : 0, measured.width);
|
||||
const surfaceHeight = Math.max(1, surface.scrollHeight);
|
||||
@@ -128,4 +138,3 @@ export function createFloatingLayer({
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user