fix(ui): bound dropdowns during scroll

This commit is contained in:
Codex
2026-07-27 14:36:35 +03:00
parent a8c8bfd89a
commit c5a6a58948
8 changed files with 100 additions and 14 deletions
+10 -1
View File
@@ -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({
},
};
}