Bug 34442 - The Select file dialog show all files when only images/videos/music files expected
Summary: The Select file dialog show all files when only images/videos/music files exp...
Status: UNCONFIRMED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-01 11:58 PST by sangeetha.sugavanam
Modified: 2022-07-01 10:57 PDT (History)
5 users (show)

See Also:


Attachments
Flidget2.zip (85.92 KB, application/x-zip-compressed)
2010-02-01 11:58 PST, sangeetha.sugavanam
no flags Details
Three file input with the three various forms of "pick all" values; "audio/*", "video/*", "image/*" (323 bytes, text/html)
2020-12-04 03:39 PST, Ole Strøm
no flags Details
mp3 and m4a files disabled in a iCloud Drive view from a file input with accept="audio/*" (474.48 KB, image/png)
2020-12-04 03:52 PST, Ole Strøm
no flags Details
Four file input with four forms of accept attributes: "audio/*", ".mp3,.m4a", "video/*", "image/*" (407 bytes, text/html)
2020-12-04 04:12 PST, Ole Strøm
no flags Details
replay of "audio/*" and ".mp3,.m4a" file inputs being used (4.14 MB, video/mp4)
2020-12-04 04:14 PST, Ole Strøm
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description sangeetha.sugavanam 2010-02-01 11:58:46 PST
Created attachment 47860 [details]
Flidget2.zip

Steps to Reproduce:
1) Launch QtLauncher.
2) Extract contents of Flidget2.zip.
3) Load Flidget.html from the extracted files.
4) Open Image File: input field.
5) Open Video File: input field.
6) Open Audio File: input field.

Expected:
R1: The select file should only show images.
R2: The select file dialog should only show videos.
R3: The select file dialog should only show music.

Actual:
The Select dialog shows all files.
Comment 1 Tor Arne Vestbø 2010-03-10 06:29:51 PST
Please follow the QtWebKit bug reporting guidelines when reporting bugs.

See http://trac.webkit.org/wiki/QtWebKitBugs

Specifically:

  - The 'QtWebKit' component should only be used for bugs/features in the
    public QtWebKit API layer, not to signify that the bug is specific to
    the Qt port of WebKit

      http://trac.webkit.org/wiki/QtWebKitBugs#Component

  - Add the keyword 'Qt' to signal that it's a Qt-related bug

      http://trac.webkit.org/wiki/QtWebKitBugs#Keywords
Comment 2 Kent Hansen 2010-03-11 06:20:28 PST
I believe this is not specific to the Qt port:
http://www.w3schools.com/TAGS/att_input_accept.asp: "The accept attribute is not properly supported by any of the major browsers."
http://htmlhelp.com/reference/html40/forms/input.html: "Current browsers generally ignore the ACCEPT attribute."

Suggest removing the Qt tag and setting the component to Forms.
Comment 3 Tor Arne Vestbø 2010-03-11 06:23:49 PST
(In reply to comment #2)
> I believe this is not specific to the Qt port:
> http://www.w3schools.com/TAGS/att_input_accept.asp: "The accept attribute is
> not properly supported by any of the major browsers."
> http://htmlhelp.com/reference/html40/forms/input.html: "Current browsers
> generally ignore the ACCEPT attribute."
> 
> Suggest removing the Qt tag and setting the component to Forms.

Sounds reasonable.
Comment 4 Ole Strøm 2020-12-04 03:39:50 PST
Created attachment 415400 [details]
Three file input with the three various forms of "pick all" values; "audio/*", "video/*", "image/*"
Comment 5 Ole Strøm 2020-12-04 03:52:57 PST
Created attachment 415402 [details]
mp3 and m4a files disabled in a iCloud Drive view from a file input with accept="audio/*"
Comment 6 Ole Strøm 2020-12-04 04:12:51 PST
Created attachment 415404 [details]
Four file input with four forms of accept attributes: "audio/*", ".mp3,.m4a", "video/*", "image/*"
Comment 7 Ole Strøm 2020-12-04 04:14:45 PST
Created attachment 415405 [details]
replay of "audio/*" and ".mp3,.m4a" file inputs being used
Comment 8 Ole Strøm 2020-12-04 04:19:44 PST
Hello! This seems to have been forgotten.

Our team just hit a weird thing related to this.

We have an app that lets users distribute recordings.

All was fine, until a colleague tried to select a mp3 file on iOS Safari.

The input field has the accept attribute set to "audio/*", but he was not able to select neither a mp3 nor m4a file from his iCloud Drive.
See https://bug-34442-attachments.webkit.org/attachment.cgi?id=415402 for a screenshot.

His device: iPhone 12 Pro, with iOS 14.2.1.

So we tried to research what this could be. We found some various hits on stackoverflow, but nothing addressed to exactly this.

Caniuse was of little help as well: https://caniuse.com/input-file-accept
There it says iOS Safari (versions 8 - 13.7, 14.2) "Supports the type format (e.g. image/*) but not the extension format (e.g. .png)", which is the opposite of what we're experiencing.

Because it worked as expected when we set accept to ".mp3,.m4a"...
See the replay at https://bug-34442-attachments.webkit.org/attachment.cgi?id=415405 for it in action.

The minimal HTML showcasing can be seen at 
https://bug-34442-attachments.webkit.org/attachment.cgi?id=415404
https://output.jsbin.com/yilametaki

or just inline:

```
<style>
    label {
        display: block;
        margin: 16px;
    }
</style>
  
<label>
    accept="audio/*"
    <input type="file" accept="audio/*">
</label>

<label>
    accept=".mp3,.m4a"
    <input type="file" accept=".mp3,.m4a">
</label>

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

<label>
    accept="image/*"
    <input type="file" accept="image/*">
</label>
```
Comment 9 Ole Strøm 2020-12-04 04:31:05 PST
Hey Matthias, I'm quite new to Bugzilla.

I hoped from some input from you, as you worked on the date input, it seemed like, and you got experience with this. I followed that bug, and was glad to see it finally happening.

So I wanted to tag you in this for some input, but I'm not sure that adding you manually to the CC list is the way to go. Please tell me so.

Should I create a new bug, or is it fine to use this 10(!) year old?
Comment 10 m.kurz+webkitbugs 2020-12-04 06:38:19 PST
Hi Ole,

> you worked on the date input
No, I did not work on the date input. I just added a couple of comments, but nothing more. I never hacked the webkit source code. Sorry.

> Should I create a new bug, or is it fine to use this 10(!) year old?

Not sure. Do you plan to provide a patch?

I think I am the wrong person to address. As said, I just follow bugs, comment on them, but nothing more.
Comment 11 Ole Strøm 2020-12-04 07:02:35 PST
Aha, my bad! Thanks for the reply anyway :)

No plans on providing a patch, as I don't even have a device to test this myself.
Comment 12 Ole Strøm 2020-12-08 01:55:00 PST
Hey Aditya!

Sneakily added you to the CC list, hoping you might be able to provide an answer to both...

< ...
> So I wanted to tag you in this for some input, but I'm not sure that adding
> you manually to the CC list is the way to go. Please tell me so.
> 
> Should I create a new bug, or is it fine to use this 10(!) year old?
Comment 13 Aditya Keerthi 2020-12-08 10:53:09 PST
(In reply to Ole Strøm from comment #12)
> Hey Aditya!
> 
> Sneakily added you to the CC list, hoping you might be able to provide an
> answer to both...
> 
> < ...
> > So I wanted to tag you in this for some input, but I'm not sure that adding
> > you manually to the CC list is the way to go. Please tell me so.
> > 
> > Should I create a new bug, or is it fine to use this 10(!) year old?

Hi Ole!

Adding me to the CC list is fine.

I think a new bug would be better, since the bug you're experiencing appears appears specific to iOS and "audio/*" in the accept attribute. (I verified that "video/*" and "image/*" work as intended).
Comment 14 Thomas Steiner 2021-03-13 13:22:54 PST
I'm hitting this issue on iOS 14.5. The problem is the following:

<input type="file" accept=".custom"> makes Safari accept any file.

<input type="file" accept=".custom,.json"> makes Safari accept only .json files, but not .custom files.

CanIUse (https://caniuse.com/input-file-accept) is indeed not 100% correct it seems, as outlined in https://bugs.webkit.org/show_bug.cgi?id=34442#c8.
Comment 15 Thomas Steiner 2021-03-13 13:24:43 PST
Safari on desktop, however, works as expected.