bug: bug: Dropdowns with ng-disabled can cause application to crash in iOS8
Type: bug
Platform: ios 8 webview
Type: bug
Platform: iOS8 (maybe other iOSes too) + Ionic v1.0.0rc5
So unfortunately this is only happening on the device so I don't think I can provide an example. It's pretty simple to reproduce though. I don't know if it was happening before RC5.
Steps to reproduce:
- Just create a dropdown like this:
<select ng-disabled="false">
<option value="moo">moo</option>
</select>
-
Open the app and when the dropdown appears, start tapping on it (I find that sometimes it doesn't happen. You have to keep tapping, and it usually helps if you start tapping as soon as it appears onscreen).
-
Expected: Nothing happens (because the select should be disabled). Actual: Eventually, the list of dropdown values will appear and the app will crash. In normal execution mode it just disappears and goes back to the home screen. If I run it from Xcode, it remains onscreen frozen, and one of the following errors is visible in the console:
2015-05-06 15:11:36.848 Algebraix[8206:5044112] *** Terminating app due to uncaught exception 'NSGenericException', reason: 'UIPopoverPresentationController (<UIPopoverPresentationController: 0x14d49100>) should have a non-nil sourceView or barButtonItem set before the presentation occurs.'
*** First throw call stack:
(0x223865f7 0x2fe3ac77 0x25ecd645 0x25afb785 0x25afa467 0x258a81f1 0x25823eff 0x2234d015 0x2234a6f9 0x2234aafb 0x22297b31 0x22297943 0x2961f051 0x2588d6f1 0xb8b43 0x303d6aaf)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
2015-05-06 16:39:31.634 Algebraix[8286:5056619] -[UIThreadSafeNode createPeripheral]: unrecognized selector sent to instance 0x165c0b90
2015-05-06 16:39:31.637 Algebraix[8286:5056619] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIThreadSafeNode createPeripheral]: unrecognized selector sent to instance 0x165c0b90'
I've tried various other combinations (on Android, other disableable input types, ng-disabled="false" etc) and as far as I can tell it's only happening with this combo:
- iOS
- select
- ng-disabled=[expression that evalutes to true]
If there's any other pertinent information I've forgotten to include, please let me know.
Thanks! Ionic is great :)
Hmm, I gave this a try and couldn't replicate it. Anyway you could provide any more information?
Hey thanks for looking into it. To be honest it's quite difficult to replicate. Seems to happen less than 50% of the time.
(Also, I only became aware of the issue after a user complained that they were able to use the dropdown normally (even though it should be disabled). I haven't been able to reproduce that - whenever I get the dropdown to appear, the app crashes immediately.)
I made a video here to try and explain better. Sorry for the shaky quality! https://www.youtube.com/watch?v=M2sYNgwzkDU
Basically I made a view like this:
<ion-view>
<ion-content class="login-page">
<form name="login">
<div class="list list-inset">
<div class="item item-divider col-center positive">Test</div>
<label class="item item-input item-select">
<div class="input-label">ng-disabled=true</div>
<select ng-model="loginData.state" ng-disabled="true">
<option ng-repeat="(key, value) in customers" value="{{key}}">{{key}}</option>
</select>
</label>
<label class="item item-input item-select">
<div class="input-label">ng-disabled=false</div>
<select ng-model="loginData.state2" ng-disabled="false">
<option>Test 1</option>
<option>Test 2</option>
<option>Test 3</option>
</select>
</label>
</div>
</form>
</ion-view>
So: two dropdowns, one disabled and one enabled.
At the start of the video, I touch the 2nd dropdown to demonstrate it works as expected. I then proceed to hammer on the 1st one (it seems to work better with the thumb...?) until the popup menu appears and it crashes. I then show the Xcode stack trace. If you run it outside of Xcode, the app just disappears offscreen at this point, rather than freezing.
If I can help in any other way, let me know. It definitely seems like an edge case. And it has an easy workaround anyway (ng-class with pointer-events: none).
Hmm yeah, I still can't seem to replicate it. If you could throw together a git repo that I could directly pull, that may be the best bet.