Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions apps/mobile-web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,31 +32,33 @@
<script>
(() => {
if (!window.visualViewport) return;
var root = document.getElementById('root') || document.body;
var root = document.documentElement;
var restoreKeyboard = () => {
if (!window.visualViewport) return;
var vh = window.visualViewport.height;
var full = window.screen.height;
var keyboardHeight = full - vh;
if (keyboardHeight > 100) {
// Keyboard is open — push the composer into the remaining viewport
root.style.setProperty('--kb-height', `${keyboardHeight}px`);
root.style.setProperty('--vh', `${vh}px`);
document.documentElement.classList.add('keyboard-open');
root.classList.add('keyboard-open');
} else {
// Keyboard is closed
root.style.removeProperty('--kb-height');
root.style.removeProperty('--vh');
document.documentElement.classList.remove('keyboard-open');
root.classList.remove('keyboard-open');
}
};
// Run once on load and on resize
restoreKeyboard();
window.visualViewport.addEventListener('resize', restoreKeyboard);
window.visualViewport.addEventListener('scroll', () => {
// iOS Safari scrolls the viewport when the keyboard opens — snap back
window.visualViewport.addEventListener('scroll', function () {
if (window.visualViewport.offsetTop !== 0) {
window.scrollTo(0, 0);
}
});
// Also check on orientation change
window.addEventListener('orientationchange', function () {
setTimeout(restoreKeyboard, 300);
});
window.addEventListener('orientationchange', () => {
setTimeout(restoreKeyboard, 300);
});
Expand Down
15 changes: 13 additions & 2 deletions apps/mobile-web/src/styles/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -322,13 +322,24 @@ textarea {
}

/* When iOS virtual keyboard is open — use visualViewport height */
html.keyboard-open,
html.keyboard-open body {
overflow: hidden;
height: 100%;
}

html.keyboard-open .h-dvh {
height: var(--vh, 100dvh);
height: var(--vh, 100dvh) !important;
}

/* Hide tab bar when keyboard is open to give more space */
html.keyboard-open nav[aria-label="Main navigation"] {
display: none;
}

/* Ensure the composer has bottom room when keyboard is open */
html.keyboard-open [data-composer] {
padding-bottom: max(var(--safe-bottom), var(--kb-height, 0px));
padding-bottom: max(var(--safe-bottom), var(--kb-height, 0px)) !important;
}

/* ── Backdrop-filter fallback ──────────────────── */
Expand Down
Loading