mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-03 14:09:42 +02:00
fix(mobile): keep the keyboard layout through a fold or rotation with the keyboard up
A shape change with the keyboard up re-baselined initialViewportHeight to the SHRUNK visual height, so heightDiff was 0 and the settle event the OS fires at the new width (or any later address-bar drift) satisfied the hide branch and ran onKeyboardHide() with the keyboard still on screen: accessory bar hidden, toolbar lift dropped, main's padding cleared. It could not recover, since no further 150px drop re-arms the show branch against a baseline already sitting at the shrunk height. Baseline to window.innerHeight instead when the keyboard is up: the page sets no interactive-widget, so the keyboard shrinks only the visual viewport and the layout viewport stays the display's full height on both engines, the same fact updateLayoutForKeyboard() relies on. The vm harness now models the two heights separately (resizeTo takes an optional layout height) and pins the fold flavour (626x590, 466x378, 466x378), the rotation flavour (393x359, 852x150, 852x160) and the eventual close. All three fail against the old line. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -362,13 +362,27 @@ const KeyboardHandler = {
|
||||
MobileDetection.updateAppHeight();
|
||||
}
|
||||
|
||||
// Update baseline when keyboard is not visible — adapts to address bar
|
||||
// Update baseline when keyboard is not visible: adapts to address bar
|
||||
// state changes, orientation changes, and other viewport shifts. A shape
|
||||
// change re-baselines even with the keyboard up (it may genuinely still be
|
||||
// open, but its old baseline belongs to a display that is gone), and still
|
||||
// writes --app-height below so the keyboard-open sizing follows the new
|
||||
// display.
|
||||
if (shapeChanged || !this.keyboardVisible) {
|
||||
//
|
||||
// ⚠️ With the keyboard up, the new baseline must be the KEYBOARD-FREE
|
||||
// height of the display the device moved to, which is window.innerHeight
|
||||
// (the layout viewport; the page sets no interactive-widget, so the
|
||||
// keyboard shrinks only the visual viewport on both engines, the same
|
||||
// fact updateLayoutForKeyboard() relies on). Baselining to the SHRUNK
|
||||
// visual height made heightDiff 0, so the very next same-width resize
|
||||
// (the settle event the OS animation produces, or any address-bar drift)
|
||||
// satisfied the hide branch and tore the keyboard layout down with the
|
||||
// keyboard still on screen, and it could not recover: no further 150px
|
||||
// drop can re-arm the show branch against a baseline that already sits
|
||||
// at the shrunk height.
|
||||
if (shapeChanged) {
|
||||
this.initialViewportHeight = this.keyboardVisible ? window.innerHeight : currentHeight;
|
||||
} else if (!this.keyboardVisible) {
|
||||
this.initialViewportHeight = currentHeight;
|
||||
}
|
||||
if (this.keyboardVisible) {
|
||||
|
||||
Reference in New Issue
Block a user