Skip to content

[bug] Android Keyboard overlay/push behavior changes between app launches #7868

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
bpevs opened this issue Sep 20, 2023 · 4 comments · May be fixed by #13277
Open

[bug] Android Keyboard overlay/push behavior changes between app launches #7868

bpevs opened this issue Sep 20, 2023 · 4 comments · May be fixed by #13277
Labels
platform: Android status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@bpevs
Copy link

bpevs commented Sep 20, 2023

Describe the bug

Basically, as the screenshots explain, sometimes when I open my app, the keyboard is overlaying over the app, and other times it pushes the content up (shortens the window height)?

I think probably the expected behavior is the latter?

I am still seeing this regression now in 2.0.0-alpha.14
Don't remember the version I was running when I first started seeing this, but I think it was in august maybe around 2.0.0-alpha.8?

Screenshot_2023-08-28_at_23 00 47

Reproduction

I think it should happen on any Android app with a text input at the bottom of the screen.

  • Open app
  • tap text input

Notice that the keyboard covers the input (screenshot right)

  • back out of app (just exit app, don't quit)
  • open app again

Keyboard should now no longer be covering the input (screenshot left)

Kinda being lazy, but I can build a reproduction repo if there isn't an easily-editable one you area already working with

Expected behavior

Input should move to be above keyboard (at least that was the behavior prior).

Platform and versions

[✔] Environment
    - OS: Mac OS 13.5.1 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.70.0 (90c541806 2023-05-31)
    ✔ Cargo: 1.70.0 (ec8a8a0ca 2023-04-25)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: stable-aarch64-apple-darwin (environment override by RUSTUP_TOOLCHAIN)

[-] Packages
    - tauri [RUST]: git+https://github.com/tauri-apps/tauri/?branch=dev#af3268a4be69e2dee72ba867ee54bc36d12712e6 (2.0.0-alpha.11)
    - tauri-build [RUST]: no manifest (2.0.0-alpha.8, 2.0.0-alpha.8)
    - wry [RUST]: 0.31.1
    - tao [RUST]: 0.22.2
    - @tauri-apps/api [NPM]: not installed!
    - @tauri-apps/cli [NPM]: 2.0.0-alpha.14

[-] App
    - build-type: bundle
    - CSP: unset
    - distDir: ../src-www
    - devPath: http://0.0.0.0:3000/

Stack trace

No response

Additional context

No response

@bpevs bpevs added status: needs triage This issue needs to triage, applied to new issues type: bug labels Sep 20, 2023
@bpevs
Copy link
Author

bpevs commented Jan 25, 2024

fwiw, adding android:windowSoftInputMode="adjustResize" to the manifest does fix this. However, that's supposed to be the default setting for the behavior of the main window, so I think this line shouldn't be necessary.

@httpjamesm
Copy link

I get this behaviour even without shifting apps. Setting that windowSoftInputMode param to my manifest fixed it.

@retorted
Copy link

Confirmed this is still an issue in Tauri 2.5.1, the behaviour around window resizing when the keyboard opens on Android is quite random as the OP describes, sometimes it resizes the screen and sometimes it covers the content. Also confirmed adding android:windowSoftInputMode="adjustResize" to the manifest file fixes it nicely

@jgonera
Copy link

jgonera commented May 10, 2025

I'm not sure if I'm hitting the same bug or a similar one. For me this happens consistently (input always covered by keyboard), but only when using edge-to-edge (which I enabled in the way indicated in this comment). For me the bug persists despite adding android:windowSoftInputMode="adjustResize" to the manifest.

@FabianLars I can see why enabling edge-to-edge would cause this, but is this a desired behavior? I would still expect to be able to accommodate for the keyboard somehow. Is there another way?

Edit: I tried using https://developer.mozilla.org/en-US/docs/Web/API/VirtualKeyboard_API to change body height in CSS when the keyboard is open (body { height: calc(100dvh - env(keyboard-inset-height)) }) but unfortunately it requires a secure context and it doesn't work in Tauri (works in Chrome). It seems that for now I might have to disable edge-to-edge for Android... It's a pity because I can achieve the edge-to-edge look on iOS where the keyboard always pushes the app up.

Edit 2: Strange, window.isSecureContext is actually true in Tauri but for some reason none of the VirtualKeyboard API functionality works. CSS env values are not set when the keyboard opens and geometrychange event doesn't fire...

Edit 3: Sigh: https://issues.chromium.org/issues/40797430. This is problematic given that edge-to-edge is the new default...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: Android status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants