Bug 236981

Summary: [iOS] Crash when selecting the "Take Photo" file picker menu item if the app doesn't have the necessary entitlements
Product: WebKit Reporter: alexhsu <weaksdfg>
Component: HTML EditingAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Major CC: akeerthi, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: Safari Technology Preview   
Hardware: iPhone / iPad   
OS: iOS 14   

Description alexhsu 2022-02-21 10:19:35 PST
Individual attributes "capture" can't disable the "take photo" on IOS
but Android can disable this
https://stackoverflow.com/questions/23234596/how-to-disable-capture-when-upload-image-file-using-safari-on-ipad
Comment 1 Radar WebKit Bug Importer 2022-02-23 15:37:30 PST
<rdar://problem/89382404>
Comment 2 Aditya Keerthi 2022-02-23 15:51:08 PST
The "Take Photo" action is displayed whenever image types are accepted by the file input, and is independent of the "capture" attribute. The spec doesn't say that we should exclude such an option if "capture" is not specified.

Can you elaborate on why you want to disable this action?
Comment 3 alexhsu 2022-02-24 04:32:08 PST
(In reply to Aditya Keerthi from comment #2)
> The "Take Photo" action is displayed whenever image types are accepted by
> the file input, and is independent of the "capture" attribute. The spec
> doesn't say that we should exclude such an option if "capture" is not
> specified.
> 
> Can you elaborate on why you want to disable this action?

sir,
The file input is not of type picture, but "Photo" still shows up, then
Clicking "take a photo" on an html page will crash the app, even if the app doesn't have permission to open the camera.
My project has webview in an APP, happens as described earlier.

So I think there has to be a feature to disable it off
Comment 4 Aditya Keerthi 2022-02-24 17:59:12 PST
(In reply to alexhsu from comment #3)
> (In reply to Aditya Keerthi from comment #2)
> > The "Take Photo" action is displayed whenever image types are accepted by
> > the file input, and is independent of the "capture" attribute. The spec
> > doesn't say that we should exclude such an option if "capture" is not
> > specified.
> > 
> > Can you elaborate on why you want to disable this action?
> 
> sir,
> The file input is not of type picture, but "Photo" still shows up, then
> Clicking "take a photo" on an html page will crash the app, even if the app
> doesn't have permission to open the camera.
> My project has webview in an APP, happens as described earlier.
> 
> So I think there has to be a feature to disable it off

Thanks for the explanation.

We currently show "Photo" options unless the input explicitly excludes images via the "accept" attribute. This means that a plain <input type=file> will always show the "Take Photo" item.

I think we should consider removing the menu item in WebKit if the app doesn't have the necessary permissions. Retitling the bug to reflect the issue more clearly. Please let me know if I have misinterpreted something.
Comment 5 alexhsu 2022-02-26 22:47:18 PST
(In reply to Aditya Keerthi from comment #4)
> (In reply to alexhsu from comment #3)
> > (In reply to Aditya Keerthi from comment #2)
> > > The "Take Photo" action is displayed whenever image types are accepted by
> > > the file input, and is independent of the "capture" attribute. The spec
> > > doesn't say that we should exclude such an option if "capture" is not
> > > specified.
> > > 
> > > Can you elaborate on why you want to disable this action?
> > 
> > sir,
> > The file input is not of type picture, but "Photo" still shows up, then
> > Clicking "take a photo" on an html page will crash the app, even if the app
> > doesn't have permission to open the camera.
> > My project has webview in an APP, happens as described earlier.
> > 
> > So I think there has to be a feature to disable it off
> 
> Thanks for the explanation.
> 
> We currently show "Photo" options unless the input explicitly excludes
> images via the "accept" attribute. This means that a plain <input type=file>
> will always show the "Take Photo" item.
> 
> I think we should consider removing the menu item in WebKit if the app
> doesn't have the necessary permissions. Retitling the bug to reflect the
> issue more clearly. Please let me know if I have misinterpreted something.

yes, as you describe
Mainly want to be able to control this property
I would like to ask about the approximate date of this bug timeline?