ionic-team / capacitor

Build cross-platform Native Progressive Web Apps for iOS, Android, and the Web ⚑️
https://capacitorjs.com
MIT License
12.26k stars 1.01k forks source link

bug: Android windowSoftInputMode:adjustPan not working #5272

Closed sawaca96 closed 2 years ago

sawaca96 commented 3 years ago

Bug Report

Capacitor Version

πŸ’Š   Capacitor Doctor  πŸ’Š 

Latest Dependencies:

  @capacitor/cli: 3.3.2
  @capacitor/core: 3.3.2
  @capacitor/android: 3.3.2
  @capacitor/ios: 3.3.2

Installed Dependencies:

  @capacitor/core: 3.2.5
  @capacitor/android: 3.2.5
  @capacitor/ios: 3.2.5
  @capacitor/cli: 3.2.5

[success] iOS looking great! πŸ‘Œ
[success] Android looking great! πŸ‘Œ

Platform(s)

android

Current Behavior

windowSoftInputMode:adjustPan not working in android

Expected Behavior

I think that setting up adjustPan would work like ios, but it actually works like adjustNothing.

Code Reproduction

I add adjustPan setting to AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.xxx.yyy">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="${displayName}"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

        <activity
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
            android:name="com.xxx.yyy.MainActivity"
            android:label="${displayName}"
            android:theme="@style/AppTheme.NoActionBarLaunch"
            android:launchMode="singleTask"
            android:windowSoftInputMode="adjustPan"
            android:hardwareAccelerated="true">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

        </activity>

        <provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="${applicationId}.fileprovider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/file_paths"></meta-data>
        </provider>
    </application>

    <!-- Permissions -->

    <uses-permission android:name="android.permission.INTERNET" />
</manifest>

Other Technical Details

npm --version output: 8.0.0

node --version output: v12.8.2

pod --version output (iOS issues only):

Additional Context

jcesarmobile commented 2 years ago

can you provide a sample app where the issue can be reproduced?

ghost commented 2 years ago

I am experiencing the same thing. My versions @capacitor/cli: 3.3.4 @capacitor/android: 3.3.4 @capacitor/core: 3.3.4 @capacitor/ios: 3.3.4

jcesarmobile commented 2 years ago

Can you provide the sample app?

ghost commented 2 years ago

Not sure if this helps. Otherwise I will have to create a sample repo when I have time. On IOS when focusing on an input, it works as expected, but on android, it just covers up the content like using adjustNothing.

Im using Vuejs3 if that matters focus before_focus

jcesarmobile commented 2 years ago

It doesn't, I need a sample app I can run

DavidConnack commented 2 years ago

@jcesarmobile Here is a sample repo: https://github.com/Concentricc/capacitor-pan

On a pixel 3 emulator on my local, the input gets covered by the keyboard when it comes into focus.

Hopes this helps

jcesarmobile commented 2 years ago

Thanks for the app.

I've been able to reproduce, but with the same app content, the behavior is the same if I put it in a Cordova app and even in a native app that just contains a WebView (with no Cordova or Capacitor involvement), so it looks like a bug on the WebView itself, not in Capacitor.

If in the native app I put some native edit text fields it scrolls properly to them, but doesn't work with web input fields.

If I remove the windowSoftInputMode or set it to adjustResize then it focus properly, but resizing the content a bit. If you don't want that behavior you'll have to use the keyboard plugin for listening for the show/hide events and scroll to the inputs yourself.

ionitron-bot[bot] commented 2 years ago

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.