Skip to content
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

Prompt dialog won't focus nor show keyboard on Android until manually tapping the text input. #139

Open
3 tasks done
Thul999 opened this issue Jun 29, 2020 · 2 comments
Open
3 tasks done

Comments

@Thul999
Copy link

Thul999 commented Jun 29, 2020

Bug Report

Problem

On Android, prompt dialog won't focus and show keyboard until manually tapping the text input.

What is expected to happen?

Automatically show keyboard when calling navigator.notification.prompt.

What does actually happen?

The prompt view is shown, but without any focus on the input field and without displaying the keyboard.

Information

There's a PR addressing the issue #132 , but still it doesn't focus in my tests.

Command or Code

navigator.notification.prompt(message, promptCallback, [title], [buttonLabels], [defaultText])

Environment, Platform, Device

Tested on Android devices running 7.1.1 (Moto G Play) & 9.0 (ZTE Blade V10 VIta).

Version information

  • Cordova CLI v9.0.0 (cordova-lib@9.0.1).
  • Android v8.1.0
  • cordova-plugin-dialogs v2.0.2
  • MacOS v10.15.5

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above
@Thul999 Thul999 changed the title Prompt dialog won't focus and show keyboard on Android until manually tapping the text input. Prompt dialog won't focus nor show keyboard on Android until manually tapping the text input. Jun 29, 2020
@Thul999
Copy link
Author

Thul999 commented Jun 29, 2020

I think I found the solution, I just need to keep testing on more devices. I added

AlertDialog dialog = dlg.create();
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
dialog.show();

to changeTextDirection function on Notification.java. Also imported WindowManager import android.view.WindowManager;

Update: This worked perfectly on Android 7.x, but not on 9.x, but after adding promptInput.requestFocus() after the changeTextDirection function call, now it also works on the latter.

@SamuelMichelRiad
Copy link

Is there an update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants