capacitor-keyboard
Skill75 starsChanged 33 days agoMITView on GitHub
Fixes on-screen keyboard behavior in Capacitor apps with @capacitor/keyboard - iOS `resize` modes (`native` default, `body`, `ionic`, `none`), `keyboardWillShow`/`keyboardDidShow` heights, `setAccessoryBarVisible`, `setScroll`, `style` (`DARK`/`LIGHT`/`DEFAULT`), `autoBackdropColor` (8.0.4+), Android edge-to-edge/SystemBars interaction (drop legacy `resizeOnFullScreen` on Capacitor 8), iOS 26 fixes, and iOS input auto-zoom. Use when inputs are hidden behind the keyboard, the WebView jumps or leaves a white/black gap above the keyboard, fixed footers float mid-screen, `vh` layouts shrink, or keyboard events do not fire. Do not use for general safe-area/notch padding (safe-area-handling), Ionic component styling (ionic-design), or form accessibility (capacitor-accessibility).
1 other project uses a version of this.
Adopted by
Most recently taken up by
- Aver005/agent-skillstheir own version, first seen Feb 14, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- Aver005/agent-skills★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository56 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- capacitor-accessibilitySkill
- capacitor-app-intentsSkill
- capacitor-apple-review-preflightSkill
- capacitor-app-storeSkill
- capacitor-app-upgradesSkill
- capacitor-app-upgrade-v4-to-v5Skill
- capacitor-app-upgrade-v5-to-v6Skill
- capacitor-app-upgrade-v6-to-v7Skill
- capacitor-app-upgrade-v7-to-v8Skill
- capacitor-app-upgrade-v8-to-v9Skill
- capacitor-best-practicesSkill
- capacitor-ci-cdSkill
- capacitor-deep-linkingSkill
- capacitor-ios-resizabilitySkill
- capacitor-ios-security-hardeningSkill
- capacitor-mcpSkill
- capacitor-offline-firstSkill
- capacitor-performanceSkill
- capacitor-plugin-spm-supportSkill
- capacitor-pluginsSkill
- capacitor-plugin-upgradesSkill
- capacitor-plugin-upgrade-v4-to-v5Skill
- capacitor-plugin-upgrade-v5-to-v6Skill
- capacitor-plugin-upgrade-v6-to-v7Skill
- capacitor-plugin-upgrade-v7-to-v8Skill
- capacitor-plugin-upgrade-v8-to-v9Skill
- capacitor-push-notificationsSkill
- capacitor-securitySkill
- capacitor-splash-screenSkill
- capacitor-testingSkill
- capacitor-uiscene-migrationSkill
- capawesome-live-update-migrationSkill
- capgo-cli-usageSkill
- capgo-cloudSkill
- capgo-live-updatesSkill
- capgo-native-buildsSkill
- capgo-organization-managementSkill
- capgo-release-managementSkill
- capgo-release-workflowsSkill
- cocoapods-to-spmSkill
- cordova-to-capacitorSkill
- debugging-capacitorSkill
- framework-to-capacitorSkill
- ionic-appflow-migrationSkill
- ionic-designSkill
- ionic-enterprise-sdk-migrationSkill
- ios-android-logsSkill
- konsta-uiSkill
- safe-area-handlingSkill
- skill-creatorSkill
- sqlite-to-fast-sqlSkill
- subscription-app-revenueSkill
- tailwind-capacitorSkill
- webapp-to-capacitorSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 90
Use max(), not +: while the keyboard is up the home-indicator inset is already covered.
- Very specific: line 96
Do not add android:windowSoftInputMode="adjustPan" to fix overlap.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Keyboard Handling in Capacitor
When to Use
TRIGGER when:
- Focused input is covered by the keyboard, or the page scrolls unexpectedly
- Chat composer / fixed footer does not stick to the keyboard
- White or black band above the keyboard (Android 15+ edge-to-edge, iOS backdrop)
100vh/dvhlayout collapses when the keyboard opens- iOS zooms into inputs, or the QuickType/accessory bar looks wrong
- Keyboard events never fire or fire twice
Do not use:
- Notch / home-indicator / status-bar padding:
safe-area-handling - Ionic
ion-input,ion-footerstyling:ionic-design - Labels, focus order, screen readers:
capacitor-accessibility
Platform model (the key decision)
| iOS | Android | |
| Who resizes | Plugin, per resize mode | OS + WebView; resize config is ignored |
| Events | keyboardWillShow before animation, keyboardDidShow after | Will/Did fire almost together |
| JS control | setResizeMode, getResizeMode, setScroll, setStyle, setAccessoryBarVisible (iPhone only) | show() (Android only), hide() |
iOS resize modes (KeyboardResize enum):
| Mode | Effect | Use when |
native (default) | Whole WebView shrinks; vh units change | Plain web apps; simplest |
body | Only <body> height changes; vh unchanged | Layouts that rely on stable vh |
ionic | Only ion-app resizes | Ionic Framework apps only |
none | Nothing resizes; you position with keyboard height | Custom chat UIs, full control |
Workflow
- Inspect:
capacitor.config.*plugins.Keyboard,@capacitor/keyboardversion (8.0.4+ includes iOS 26 and Android SystemBars fixes), whether Ionic is used,@capacitor/status-bar/ SystemBars config, and the failing screen's CSS (position: fixed,100vh). - Reproduce on a device (simulators often use a hardware keyboard: iOS Simulator -> I/O -> Keyboard -> Toggle Software Keyboard).
- Pick the iOS resize mode from the table; set it in config, not at runtime, unless one screen needs a different mode.
- Fix Android separately (below).
- Verify.
Config
// capacitor.config.ts
import { KeyboardResize, KeyboardStyle } from '@capacitor/keyboard';
plugins: {
Keyboard: {
resize: KeyboardResize.Body, // iOS only
style: KeyboardStyle.Default, // iOS only; JSON value is "DARK" | "LIGHT" | "DEFAULT"
// resizeOnFullScreen: omit on Capacitor 8+ (SystemBars handles insets; see Android notes)
autoBackdropColor: 'auto', // iOS, 8.0.4+: 'off' (default) | 'auto' | 'dom'
},
},String values in JSON config are uppercase for style ("DARK"), lowercase for resize ("body").
Custom positioning (resize: none or chat UIs)
import { Capacitor } from '@capacitor/core';
import { Keyboard } from '@capacitor/keyboard';
if (Capacitor.isNativePlatform()) {
Keyboard.addListener('keyboardWillShow', ({ keyboardHeight }) => {
document.documentElement.style.setProperty('--kb', `${keyboardHeight}px`);
});
Keyboard.addListener('keyboardWillHide', () => {
document.documentElement.style.setProperty('--kb', '0px');
});
}.composer {
position: fixed;
inset-inline: 0;
bottom: max(var(--kb, 0px), env(safe-area-inset-bottom));
}Use max(), not +: while the keyboard is up the home-indicator inset is already covered.
Android notes
- Android 15+ (targetSdk 35) enforces edge-to-edge; Android 16 (targetSdk 36, Capacitor 8 default) removes the opt-out. The WebView now draws under system bars, so the keyboard inset must be handled.
@capacitor/keyboard7.0.2 fixed white space above the keyboard on Android 15+, and 8.0.3 fixed the interaction with the SystemBars core plugin. Update the plugin before writing workarounds. resizeOnFullScreen: truewas the Capacitor <= 7 workaround for fullscreen / overlaid status bar. On Capacitor 8+ the SystemBars core plugin handles IME insets and logsYou should omit `Keyboard.resizeOnFullScreen` in your `capacitor.config.json`. Other values can lead to unexpected behavior.unlessSystemBars.insetsHandlingisdisable. Remove it.- Do not add
android:windowSoftInputMode="adjustPan"to fix overlap; it pans the whole window and breaks fixed headers. The template omits it (default resize behavior). env(keyboard-inset-height)andinteractive-widgetviewport meta are Chromium features; test on the target Android System WebView version before relying on them, and never on iOS.
iOS notes
- Inputs with computed
font-size< 16px make iOS zoom on focus. Usefont-size: 16px(or larger) on inputs; do not disable user zoom globally (maximum-scale=1) as it hurts accessibility. setAccessoryBarVisible({ isVisible: false })hides the prev/next/done bar on iPhone; it has no effect on iPad.setScroll({ isDisabled: true })stops the WebView scroll view from bouncing when the keyboard opens; pair withresize: nonefor custom layouts.- iOS 26 keyboard regressions and the iPad Magic Keyboard black QuickType bar were fixed in
@capacitor/keyboard8.0.4. If a black/white band appears behind the keyboard, setautoBackdropColor: 'auto'(usesbackgroundColorfrom config, else the DOM body background) or'dom'.
Verification
npx cap syncand run on a physical iPhone and an Android 15+/16 device.- For each form screen: focus first and last input; the focused field stays visible; footer sits on the keyboard; no gap above the keyboard; rotating with the keyboard open keeps layout.
- Dismiss via swipe/back button:
keyboardWillHidefires and--kbreturns to 0. - iOS: confirm no zoom on focus; accessory bar state matches the design.
- Check versions:
npm ls @capacitor/keyboard @capacitor/core.
Error Handling
| Symptom / message | Cause | Fix |
"Keyboard" plugin is not implemented on web or "Keyboard.setAccessoryBarVisible()" is not implemented on android | Plugin/method unavailable on that platform | Guard with Capacitor.getPlatform() === 'ios' |
show() does nothing on iOS | show() is Android only | Focus an input from a user gesture instead |
| Footer floats in the middle after keyboard closes (Android) | WebView height not reset when keyboard hides without animation | Update to @capacitor/keyboard 8.0.4+ |
| White band above keyboard on Android 15+ | Edge-to-edge insets + old plugin | Update plugin (7.0.2+ / 8.0.3+); on Capacitor 8 remove resizeOnFullScreen |
Logcat SystemBars: You should omit `Keyboard.resizeOnFullScreen` ... | Legacy config fighting SystemBars inset handling | Delete resizeOnFullScreen from config |
vh-based screen shrinks on iOS | resize: native changes viewport | Switch to body or none |
| Ionic content jumps twice | resize: native/body plus Ionic's own handling | Use resize: 'ionic' |
| Listeners fire twice after navigation | Listener added per page mount, never removed | Keep the returned handle and await handle.remove() on unmount |
| Black QuickType bar on iPad with hardware keyboard | Pre-8.0.4 plugin bug | Update plugin |
Resources
- Keyboard plugin API: https://capacitorjs.com/docs/apis/keyboard
- Plugin changelog: https://github.com/ionic-team/capacitor-keyboard/blob/main/CHANGELOG.md
- System Bars (edge-to-edge): https://capacitorjs.com/docs/apis/system-bars
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

