Bug 242110 - File input treats accept="audio/*" as accept="video/*"
Summary: File input treats accept="audio/*" as accept="video/*"
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: Safari 15
Hardware: iPhone / iPad iOS 15
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-06-29 08:44 PDT by Sam Gentle
Modified: 2022-07-06 08:45 PDT (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Gentle 2022-06-29 08:44:59 PDT
When iOS Safari encounters a file input with an accept attribute of "audio/*", like so:

<input type="file" accept="audio/*">

It treats it identically to the following:

<input type="file" accept="video/*">

That is, it offers the photo library and video recorder as options, and the file picker is filtered to include video files (eg, .flv, .mp4), but not audio files (eg .mp3, .wav, .m4a).

I believe this was introduced by r250410, which made UTIsForMIMETypes return a UTTypeMovie instead of a UTTypeAudio so that the video recorder could be used for audio capture. However, this means that UTTypeMovie is also passed to the file picker (via the reference to _acceptedUTIs in showFilePickerMenu).

The tests in LayoutTests/fast/forms/ios/file-upload-panel.html (updated in r252051) seem to indicate that at least the photo library and video recorder options are intentional, though the resulting file has a video/quicktime MIME type. The tests in LayoutTests/fast/forms/ios/file-upload-panel-accept.html don't cover "audio/*".

Also mentioned in bug 234566 and bug 34442 comment 8.
Comment 1 Radar WebKit Bug Importer 2022-07-06 08:45:12 PDT
<rdar://problem/96520846>