Skip to content

Commit 7bca531

Browse files
committed
work
1 parent e6d1847 commit 7bca531

10 files changed

Lines changed: 1074 additions & 315 deletions

packages/frontend/dom/dist/jsenv_dom.js

Lines changed: 288 additions & 147 deletions
Large diffs are not rendered by default.

packages/frontend/navi/dist/dev/jsenv_navi.js

Lines changed: 346 additions & 64 deletions
Large diffs are not rendered by default.

packages/frontend/navi/dist/dev/jsenv_navi.js.map

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/frontend/navi/dist/dev/jsenv_navi_side_effects.js

Lines changed: 31 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/frontend/navi/dist/dev/jsenv_navi_side_effects.js.map

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/frontend/navi/dist/jsenv_navi.js

Lines changed: 321 additions & 64 deletions
Large diffs are not rendered by default.

packages/frontend/navi/dist/jsenv_navi.js.map

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/frontend/navi/dist/jsenv_navi_side_effects.js

Lines changed: 31 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/frontend/navi/dist/jsenv_navi_side_effects.js.map

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/frontend/navi/src/layout/responsive.js

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ export const windowHeightSignal = signal(window.innerHeight);
1010

1111
// Debounced (not a raw "resize" listener) — see window_size.js's own
1212
// module comment: mobile fires a transient "resize" when the browser's own
13-
// UI chrome (address bar, etc.) briefly shows/hides, and this needs to
14-
// settle on the exact same tick as visualViewport's own debounced resize
15-
// below and Popover/Dialog's own repositioning, or one flickers a moment
16-
// out of sync with the others.
13+
// UI chrome (address bar, etc.) briefly shows/hides, and this needs to settle
14+
// on the same tick as Popover/Dialog's own repositioning, or one flickers a
15+
// moment out of sync with the others.
1716
subscribeWindowResizeSettled(() => {
1817
windowWidthSignal.value = window.innerWidth;
1918
windowHeightSignal.value = window.innerHeight;
@@ -36,6 +35,32 @@ if (vv) {
3635
visualViewportWidthSignal.value = vv.width;
3736
visualViewportHeightSignal.value = vv.height;
3837
};
38+
// The two directions are not equally trustworthy, and treating them alike is
39+
// what makes one of the two bugs unavoidable.
40+
//
41+
// SMALLER is believed at once. Something now covers the screen, and what is
42+
// sized against these numbers — the dialog/popover ceilings, through
43+
// --navi-vvh (navi_css_vars.js) — has to answer the smaller screen in the
44+
// same frame the placement does. The placement reads the viewport live (see
45+
// getVisibleViewportRect in @jsenv/dom), so a ceiling arriving a debounce
46+
// later means a box sized for a screen that is gone, placed in the one that
47+
// replaced it.
48+
//
49+
// BIGGER waits for the resize to settle, because growing back is the reading
50+
// a mobile browser lies about: going straight from one field to the next
51+
// fires a blur/focus pair that briefly reports the full height again, with
52+
// the keyboard never having left. Believed, it flicks every popup back to
53+
// full height and down again between two taps — the "two inputs" case in
54+
// Dialog's own demo. Nothing is lost by waiting: a keyboard that really left
55+
// stays gone, and the settled event lands 100ms later.
56+
vv.addEventListener("resize", () => {
57+
if (
58+
vv.width < visualViewportWidthSignal.peek() ||
59+
vv.height < visualViewportHeightSignal.peek()
60+
) {
61+
update();
62+
}
63+
});
3964
subscribeVisualViewportResizeSettled(update);
4065
vv.addEventListener("scroll", update);
4166
}

0 commit comments

Comments
 (0)