<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>271705</bug_id>
          
          <creation_ts>2024-03-26 06:57:21 -0700</creation_ts>
          <short_desc>iOS: &lt;input type=&quot;file&quot; webkitdirectory&gt; doesn&apos;t work.</short_desc>
          <delta_ts>2025-03-24 14:54:05 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Forms</component>
          <version>Safari 17</version>
          <rep_platform>iPhone / iPad</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=284457</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Daniel Jacobs">danielhunterjacobs</reporter>
          <assigned_to name="Lily Spiniolas">lily_spiniolas</assigned_to>
          <cc>akeerthi</cc>
    
    <cc>ap</cc>
    
    <cc>cdumez</cc>
    
    <cc>karlcow</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>wenson_hsieh</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2023906</commentid>
    <comment_count>0</comment_count>
    <who name="Daniel Jacobs">danielhunterjacobs</who>
    <bug_when>2024-03-26 06:57:21 -0700</bug_when>
    <thetext>https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory#result on Safari on iOS does not let you select a directory.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2023995</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2024-03-26 13:03:58 -0700</bug_when>
    <thetext>Looks like this is the only code we have referencing this attribute:

// As of Sept 2017, Chrome and Firefox both only populate webkitEntries when the webkitdirectory flag is unset.
// We do the same for consistency.
if (input.hasAttributeWithoutSynchronization(webkitdirectoryAttr))
    return { };

Weird that it got documented somewhere, and even specced.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2024086</commentid>
    <comment_count>2</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2024-03-26 20:12:33 -0700</bug_when>
    <thetext>webkitdirectory was implemented in Gecko (Firefox) on June 2016
https://bugzilla.mozilla.org/show_bug.cgi?id=1258489
This was implemented for compatibility reasons with *Chrome* (when Chrome was using webkit) for websites like mega.nz in the past.

There was at the time a spec issue opened on the compat spec.
https://github.com/whatwg/compat/issues/54

It was eventually added to the File and Directory Entries API, Draft Community Group Report, which is not on the W3C standard track
https://wicg.github.io/entries-api/#html-forms

The document is clear
&gt; NOTE: The APIs described by this document was initially implemented in Google Chrome. Other browsers (at this time: Edge, Firefox and Safari) are starting to support subsets of Chrome’s APIs and behavior. The intent of this document is to specify the common subset to ensure that the implementations are interoperable.


This is also in WebKit code. 
https://searchfox.org/mozilla-central/rev/fb2ad9ca7150890da5cadc458acdd10c87fd9a12/dom/html/HTMLInputElement.h#712-714

In addition to Safari on iOS (this bug), note that this is not available on Firefox Android.

I don&apos;t remember seeing anything recently about spec work around directly uploads.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2024088</commentid>
    <comment_count>3</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2024-03-26 20:28:26 -0700</bug_when>
    <thetext>&lt;rdar://problem/125457578&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2024091</commentid>
    <comment_count>4</comment_count>
    <who name="Aditya Keerthi">akeerthi</who>
    <bug_when>2024-03-26 20:38:02 -0700</bug_when>
    <thetext>Just to correct Alexey&apos;s comment, as that is not the only use of the attribute. The important use is here:

```
bool FileInputType::allowsDirectories() const
{
    ASSERT(element());
    if (!element()-&gt;document().settings().directoryUploadEnabled())
        return false;
    return element()-&gt;hasAttributeWithoutSynchronization(webkitdirectoryAttr);
}
```

Which is set on `FileChooserSettings`. However, we are currently not reading the bit, and have not yet implemented the feature on iOS.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2065364</commentid>
    <comment_count>5</comment_count>
    <who name="Lily Spiniolas">lily_spiniolas</who>
    <bug_when>2024-10-03 21:30:52 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/34675</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2065483</commentid>
    <comment_count>6</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-10-04 09:34:22 -0700</bug_when>
    <thetext>Committed 284685@main (ca350c23acde): &lt;https://commits.webkit.org/284685@main&gt;

Reviewed commits have been landed. Closing PR #34675 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2105578</commentid>
    <comment_count>7</comment_count>
    <who name="Daniel Jacobs">danielhunterjacobs</who>
    <bug_when>2025-03-24 07:53:02 -0700</bug_when>
    <thetext>Are you sure this is working? Is it working on iOS 18.3? If not, what version of iOS supports or will support it? I tested https://codepen.io/danieljacobs/pen/VwodKYg with a device using iOS 18.3 and was not able to select a directory, just a file.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2105581</commentid>
    <comment_count>8</comment_count>
    <who name="Daniel Jacobs">danielhunterjacobs</who>
    <bug_when>2025-03-24 07:56:24 -0700</bug_when>
    <thetext>That codepen works on Chrome on Android and every desktop browser I&apos;ve tried, and https://bugzilla.mozilla.org/show_bug.cgi?id=1887878 is open to support it on Firefox on Android.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2105689</commentid>
    <comment_count>9</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2025-03-24 14:54:05 -0700</bug_when>
    <thetext>This should be fixed in iOS 18.4 beta. Please let us know how it goes for you!</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>