-
Notifications
You must be signed in to change notification settings - Fork 991
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
app hang while showing alert when select dropdown box is actively showing #1047
Comments
So if I understand correctly, if the native browser select box is opened, and Since you're dealing with native browser UI, this smells like a browser bug. I would try your test case with pure safari using https://jsfiddle.net/ or something. Potential workaround is to not rely on the browser alert dialog and use the dialogs plugin instead, which is non-blocking asynchronous. |
Yes it is not visible but it doesn't show under select modal too. It is just not showing and the whole page is not responding, any click to the button or input element are not receivable.
I have tried just now, it doesn't happen in Safari in my ipad. What my guess is, Cordova using WebView implementation and also implement its own alert modal, which is not the same as the native browser. The alert modal (guess it is UIAlertController) doesn't work well while there is select modal (not sure this, might be other UIViewController) showing. I will try to look into "dialogs plugin", although that is not convenient, because the usage of "alert()" is everywhere in my project. |
Yah, you might be right here. I'm not too familiar with objective-c or the ios code base for that matter but Cordova has a `CDVWebViewUIDelegate class that looks like it handles how to display the alert box among other native modals like confirm and prompt. cordova-ios/CordovaLib/Classes/Private/Plugins/CDVWebViewEngine/CDVWebViewUIDelegate.m Lines 35 to 55 in 7e3402c
This is where my expertise kinda ends. I'm not sure if there is a way to ensure that the alert modal is always displayed on top or if there is any other potential solutions but I think this method is the method of interest. |
Yes, I guess something need to change there. I used to see people encounter crashing when multiple alert() being called at the same time, I guess this issue already fixed by Apple because I didn't encounter it anymore in Cordova. For example, this. For the case reported above, it might be similar root cause, selectbox dropdown UIPopoverPresentationController somehow conflict with the UIAlertController. So in the method you share, I guess it need to dismiss/check UIPopoverPresentationController first before showing new alert box. |
I don't know if this is directly related, but I'm currently investigating an issue in our app where an alert is sent while a date picker is open. What happens is the alert appears and instantly disappears by itself, the picker also disappears by itself, and then the date element becomes unresponsive and also persists on the screen through successive Cordova screens. The only way to clear it is to force-quit the app and relaunch. This only happens in iOS 14. My app is built using Cordova 10.0.0 and iOS platform 6.1.1. |
@JeffBerman yes, sound like quite related, very similar to what I have encountered. Hope the developer can investigate this as soon as possible. |
I don't think this is what is happening. In our app, the first time we send an alert it works, but the second time the alert never shows and the app hangs and must be force-quit (however, if the keyboard is visible at the time then the app hangs on the first try). I am not an expert with this stuff, but I debugged our Cordova app while the alert dialog was displayed and could graphically see the alert view in Xcode in the view hierarchy. When an alert is sent the second time (which causes the app to hang), the alert view doesn't appear in the list of views. Further, I placed breakpoints at all relevant lines in CDVWebViewUIDelegate.m, and they don't break when Update: It turns out that our app calls |
Bug Report
app hang while showing alert when select dropdown box is actively showing
Problem
cordova app went hang when calling javascript executing alert() when user has clicked the select box and the select box dropdown box is showing on screen
What is expected to happen?
alert box should show on top of the page, the app shouldn't hang
What does actually happen?
Information
Please refer to the code below, there are one select box and one button, first, please click the button, the alert box will show after 2 seconds. After the button is clicked, do click the "select" box immediately, after that, wait for 2 seconds. Dismiss the dropdown box, the app will go hang and nothing is responding anymore.
Command or Code
Code snippet:
Environment, Platform, Device
iOS device (iphone or ipad), tested in iOS 13 and 14
Version information
What are relevant versions you are using?
For example:
Cordova CLI 10.0.0
Cordova iOS: 6.1.0
Checklist
The text was updated successfully, but these errors were encountered: