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

Lost Focus after Fullscreen exit #1206

Closed
2 of 3 tasks
Heddy147 opened this issue Apr 14, 2021 · 5 comments · Fixed by #1216
Closed
2 of 3 tasks

Lost Focus after Fullscreen exit #1206

Heddy147 opened this issue Apr 14, 2021 · 5 comments · Fixed by #1216

Comments

@Heddy147
Copy link
Contributor

Heddy147 commented Apr 14, 2021

Bug Report

Problem

What is expected to happen?

After entering in fullscreen mode of a video then press the back button of android the fullscreen mode exits.
If you then press the back button again it should dispatch the 'backbutton' event.

What does actually happen?

After entering in fullscreen mode of a video then press the back button of android the fullscreen mode exits.
If you then press the back button again it does not dispatch the 'backbutton' event and closes the app.

Information

The focus does not requested after "hide the custom view". So the context of the 'backbutton' is not the WebView.

Command or Code

in #822 is fix to avoid this bug: #822 (comment)
In CordovaWebViewImpl.java:hideCustomView add engine.getView().requestFocus(); after engine.getView().setVisibility(View.VISIBLE);

Fork of same user have inserted the code:
https://github.com/josephlodero/cordova-android/blob/backbuttonfix/framework/src/org/apache/cordova/CordovaWebViewImpl.java

Environment, Platform, Device

Android, testet on Samsung SM-G780F (Galaxy S20 FE). Other developers on other android devices have the same issue.

Version information

cordova-cli: 10.0.0
cordova-android: 9.0.0

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above
@th3hamm0r
Copy link

We're currently facing an issue, which seems a bit related: In our case, if we listen for the "backbutton" event directly on the app start (after deviceready), it won't be called unless the user first clicks at the webview/app.

On older devices (eg. Android 6) this is working. On devices with Android 10 and 11, the user has to touch the app screen first, otherwise the "backbutton"-event won't be fired.

@Heddy147
Copy link
Contributor Author

We're currently facing an issue, which seems a bit related: In our case, if we listen for the "backbutton" event directly on the app start (after deviceready), it won't be called unless the user first clicks at the webview/app.

On older devices (eg. Android 6) this is working. On devices with Android 10 and 11, the user has to touch the app screen first, otherwise the "backbutton"-event won't be fired.

Yes, I have to click the webview/app, the focus is back to the webview and it fires the "backbutton"-event.

@Hanzofm
Copy link

Hanzofm commented Apr 23, 2021

Same here with cordova-android 9.0.0 version

@ljudbane
Copy link

We're currently facing an issue, which seems a bit related: In our case, if we listen for the "backbutton" event directly on the app start (after deviceready), it won't be called unless the user first clicks at the webview/app.

On older devices (eg. Android 6) this is working. On devices with Android 10 and 11, the user has to touch the app screen first, otherwise the "backbutton"-event won't be fired.

This looks like an issue with Splash screen plugin. I've had a similar issue that BACK button closed the app unless something was clicked inside the app. Once 'it got focus' the BACK button started working normaly, i.e. it was caught by my handler. Relevent issue from splash screen project.

Sorry for going off-topic a bit, i just wanted to clarify that BACK button not working at application start is a different issue.

@ucsbricks
Copy link

Any news when this PR will be merged?

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

Successfully merging a pull request may close this issue.

5 participants