Skip to content

Place file input inside ion-content won't allow user to select file on Mobile Safari #1237

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

Closed
phuongnd08 opened this issue Apr 30, 2014 · 13 comments
Assignees

Comments

@phuongnd08
Copy link

I put a simple <input type="file"> inside ion-view > ion-content and user can't click on it to select file. Its screenshot:
screen shot 2014-04-30 at 7 59 36 pm

This is the codepen: http://codepen.io/anon/pen/EmaiB

@adamdbradley
Copy link
Contributor

I tested the codepen example on iOS6 iPad, iOS7.0 iPad, and iOS7.1 iPhone5 and they all worked.

@phuongnd08
Copy link
Author

It worked on iOS 7.0 Simulator for me. But failed on iOS 6.1 iPhone 5, iOS 6.1 Simulator (both iPhone and iPad).

@adamdbradley
Copy link
Contributor

Are you including any other libraries, or using the codepen example directly which uses an iframe? I also tested with iOS 6.1 iPhone 4 simulator, and 6.1 iPhone 5 simulator and it worked every time. One note though is that the input[file] is not able to remove the 300ms delay, which is all the more confusing because all of the tap/click code is being avoided because its type is a file.

@phuongnd08
Copy link
Author

The codepen above does not use any library except ionic-bundle, and it doesn't work on my iOS 6.1 (iphone 5) and any simulator against iOS 6.1. I'm open using the iframe URL and it doesn't work as well. To be clear, my iphone 5 is running iOS 6.1.4 - 10B350 and my simulator is running iOS 6.1 - 10B141.

@phuongnd08
Copy link
Author

I just modified the code pen to include 2 file inputs. One outside of ionic and one inside. The one outside is working fine. The one inside is not responding to click: http://codepen.io/anon/pen/EmaiB

@yxztj
Copy link

yxztj commented May 1, 2014

I'm facing the exact same issue. The file input is not working inside ion-content, but everything fine outside. Tested both on Android 4.4 and iOS 7.0.4.

@yxztj
Copy link

yxztj commented May 1, 2014

@adamdbradley Some additional information about the issue:

  1. I was using ionic 0.9.27, file input was OK. When I upgraded to ionic beta2 yesterday, the issue appeared.
  2. To repro the issue, create a project by: ionic start myApp tabs, modify www/templates/friend-detail.html like this:
<input  type="file" style="position: absolute;z-index: 99999; top:80px;" />
<ion-view title="{{friend.name}}">
  <ion-content has-header="true" padding="true">
   <input  type="file" style="position: absolute;z-index: 99999; top:120px;" />
 </ion-content>

The first input above ion-view is working properly, but the second input inside ion-content is not working.
3. The issue can repro on an ios simulator(7.0.4) or iphone5/Android device, but CANNOT repro on desktop Chrome/Safari/Firefox.
4. I just upgraded to beta3, the issue is still there.

Thanks!

@adamdbradley
Copy link
Contributor

Ok, I finally see what the issue was, thanks for staying on it and providing some testing scenarios. It came down to the scroll's touchstart event having to not preventDefault for a file input, which is the same with range inputs. Thanks!

@yxztj
Copy link

yxztj commented May 1, 2014

@adamdbradley It works now. Thanks:)

@phuongnd08
Copy link
Author

👍 Thanks @adamdbradley

@adamdbradley
Copy link
Contributor

Great, thanks for helping debug!

@kovacssupki
Copy link

i have this problem also in ionic 1!!! please check if there was some regression?

@ionitron-bot
Copy link

ionitron-bot bot commented Sep 4, 2018

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants