[Webkit-unassigned] [Bug 279606] New: File input element accept attribute doesn't allow filtering by file extension

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Sep 12 12:48:30 PDT 2024


https://bugs.webkit.org/show_bug.cgi?id=279606

            Bug ID: 279606
           Summary: File input element accept attribute doesn't allow
                    filtering by file extension
           Product: WebKit
           Version: Safari 17
          Hardware: iPhone / iPad
                OS: iOS 17
            Status: NEW
          Severity: Major
          Priority: P2
         Component: Forms
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: daclark at adobe.com
                CC: cdumez at apple.com, wenson_hsieh at apple.com

The HTML file input element should support limiting the user to selecting files with specific file extensions. 

However, this functionality does not work as expected on Safari for iPhone or iPad, even though it works on Safari for desktop and other major browsers.

For example, the following input element is supposed to limit users to files ending with *.foo:
<input type="file" accept=".foo">

On iOS, any file can be selected, as if the accept attribute had not been specified (bug). By contrast, on Safari for desktop, the user is limited to files matching *.foo (expected).

You can see the behavior in action by opening this JS Fiddle in any browser:
https://jsfiddle.net/vyg9fqpd/

References:
https://html.spec.whatwg.org/multipage/input.html#file-upload-state-(type=file)
https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept#unique_file_type_specifiers

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20240912/9cbff0ae/attachment.htm>


More information about the webkit-unassigned mailing list