fix: zoom-aware clamping in cookbook task/serve dropdown positioning
Some checks are pending
ci / docker publish / build (amd64) (push) Waiting to run
ci / docker publish / build (arm64) (push) Waiting to run
ci / docker publish / merge manifest + tag (push) Blocked by required conditions

The initial positioning used zoom-divided rect coordinates but the
visualViewport clamping block used raw rect.bottom/rect.top without
dividing by zoom. At ui-scale-125 the clamp pushed dropdowns off-screen.
Affected cookbook task menu-btn and serve-config dropdown menus.
This commit is contained in:
Lukas Parsons 2026-07-07 16:26:27 -04:00
parent 596d5b7ed2
commit 6c9e04fa69
2 changed files with 4 additions and 4 deletions

View file

@ -2544,9 +2544,9 @@ export function _renderRunningTab() {
const viewBottom = vv ? vv.offsetTop + vv.height : window.innerHeight; const viewBottom = vv ? vv.offsetTop + vv.height : window.innerHeight;
const dh = dropdown.offsetHeight; const dh = dropdown.offsetHeight;
const m = 8; const m = 8;
let top = rect.bottom + 2; let top = rect.bottom / z + 2;
if (top + dh > viewBottom - m) { if (top + dh > viewBottom - m) {
const above = rect.top - 2 - dh; const above = rect.top / z - 2 - dh;
top = above >= viewTop + m ? above : Math.max(viewTop + m, viewBottom - dh - m); top = above >= viewTop + m ? above : Math.max(viewTop + m, viewBottom - dh - m);
} }
dropdown.style.top = top + 'px'; dropdown.style.top = top + 'px';

View file

@ -1090,9 +1090,9 @@ function _rerenderCachedModels() {
const viewBottom = vv ? vv.offsetTop + vv.height : window.innerHeight; const viewBottom = vv ? vv.offsetTop + vv.height : window.innerHeight;
const dh = dropdown.offsetHeight; const dh = dropdown.offsetHeight;
const mm = 8; const mm = 8;
let top = rect.bottom + 2; let top = rect.bottom / z + 2;
if (top + dh > viewBottom - mm) { if (top + dh > viewBottom - mm) {
const above = rect.top - 2 - dh; const above = rect.top / z - 2 - dh;
top = above >= viewTop + mm ? above : Math.max(viewTop + mm, viewBottom - dh - mm); top = above >= viewTop + mm ? above : Math.max(viewTop + mm, viewBottom - dh - mm);
} }
dropdown.style.top = top + 'px'; dropdown.style.top = top + 'px';