Lost Focus after Fullscreen exit
See original GitHub issueBug 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: https://github.com/apache/cordova-android/issues/822#issuecomment-552271879
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
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
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.
Any news when this PR will be merged?