Skip to content

Keyboard resize not applying when switching to emoji keyboard #2363

Open
@mrfelfel

Description

@mrfelfel

Bug Report

Plugin(s)

@capacitor/keyboard: ^7.0.1

Capacitor Version

7.2.0

Platform(s)

  • Android

Current Behavior

When switching from the regular keyboard to the emoji keyboard, the WebView does not resize automatically to adjust to the new keyboard height. This issue does not occur in Capacitor v6, where the resizing worked correctly even when switching between the regular keyboard and the emoji keyboard. The adjustResize mode in AndroidManifest.xml is set, but resizing does not occur when the emoji keyboard is shown.

Expected Behavior

The WebView should automatically resize whenever the keyboard type switches (e.g., from the regular keyboard to the emoji keyboard), just like it did in Capacitor v6. The content should reflow correctly, and there should be no overflow or layout issues when the keyboard shows or switches.

Code Reproduction

This issue can be reproduced in any WebView-based Capacitor 7 app by focusing on an input field and switching between the regular keyboard and the emoji keyboard.

Steps to reproduce:

  1. Open a WebView-based app on Android.
  2. Focus on an input field to bring up the system keyboard.
  3. Switch from the regular keyboard to the emoji keyboard.
  4. Observe that the content in the WebView does not resize, causing layout issues.

Other Technical Details

  • Capacitor version: 7.0.1
  • Android version: Test on Android 14 or later.
  • WebView-based app.
  • windowSoftInputMode="adjustResize" is set in AndroidManifest.xml.

Additional Context

  • The issue was not present in Capacitor v6, where resizing occurred as expected when switching keyboard types.
  • It seems that the resize event is not triggered when switching to the emoji keyboard, possibly due to a regression in how Capacitor 7 handles keyboard changes.
  • A possible fix could involve manually handling the keyboard resize events by using a native listener (such as OnGlobalLayoutListener) and adjusting the WebView content accordingly.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions