Hide nav when keyboard is open

This commit is contained in:
Jon Staab
2025-11-25 15:30:40 -08:00
parent bfdc69f18c
commit e083719ceb
5 changed files with 40 additions and 2 deletions
+3 -2
View File
@@ -110,9 +110,10 @@
{@render children?.()}
<!-- a little extra something for ios -->
<div class="fixed bottom-0 left-0 right-0 z-nav h-[var(--saib)] bg-base-100 md:hidden"></div>
<div class="bottom-nav fixed bottom-0 left-0 right-0 z-nav h-[var(--saib)] bg-base-100 md:hidden">
</div>
<div
class="border-top bottom-sai fixed left-0 right-0 z-nav h-14 border border-base-200 bg-base-100 md:hidden">
class="bottom-nav border-top bottom-sai fixed left-0 right-0 z-nav h-14 border border-base-200 bg-base-100 md:hidden">
<div class="content-padding-x content-sizing flex justify-between px-2">
<div class="flex gap-2 sm:gap-6">
<PrimaryNavItem title="Home" href="/home">
+21
View File
@@ -0,0 +1,21 @@
import {Capacitor} from '@capacitor/core'
import {Keyboard} from "@capacitor/keyboard"
import {noop} from '@welshman/lib'
export const syncKeyboard = () => {
if (!Capacitor.isNativePlatform()) return noop
const showListener = Keyboard.addListener("keyboardWillShow", () => {
document.body.classList.add("keyboard-open")
})
const hideListener = Keyboard.addListener("keyboardWillHide", () => {
document.body.classList.remove("keyboard-open")
})
return () => {
showListener.then(listener => listener.remove())
hideListener.then(listener => listener.remove())
document.body.classList.remove("keyboard-open")
}
}