Closed Bug 1282870 Opened 8 years ago Closed 8 years ago

input.webkitdirectory doesn't work

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla50
Tracking Status
firefox50 --- fixed

People

(Reporter: dietrich, Assigned: baku)

References

Details

(Keywords: dev-doc-needed)

Attachments

(1 file, 1 obsolete file)

This feature added in bug 1258489 for compat, but is non-functional.
Using Nightly 50.0a1 (2016-06-28) and Addy Osmani's sample at http://jsfiddle.net/addyo/Ha979/ I got the following results:

* File picker only picks files, not directories, which seems like the opposite of the expected behavior. Chrome doesn't allow file picking, only directories (which perhaps is a bug... https://bugs.chromium.org/p/chromium/issues/detail?id=59818).

* Dropping a directory onto the <input> lists the directory name, not the files contained within. Chrome lists the files contained within the dropped directory, but not the directory itself.
webkitdirectory is not enabled by default, so did you actually enable the pref dom.webkitBlink.dirPicker.enabled?
webkitdirectory implementation is still missing stuff like form submission, though that is about to land.
Flags: needinfo?(dietrich)
Yes, see my final comment from bug 1258489.

Perhaps I have done something wrong. I'm continually told in bugs I report that I must not be seeing what I'm seeing. I'd prefer to be incorrect ;) You can try the URL above for yourself, it's quite simple to test there.
Flags: needinfo?(dietrich)
Assignee: nobody → amarchesini
Attached patch fix.patch (obsolete) — Splinter Review
Attachment #8766214 - Flags: review?(bugs)
(In reply to Dietrich Ayala (:dietrich) from comment #3)
 
> Perhaps I have done something wrong. I'm continually told in bugs I report
> that I must not be seeing what I'm seeing. I'd prefer to be incorrect ;) You
> can try the URL above for yourself, it's quite simple to test there.
Hah. It wasn't just clear from this bug report that the pref was enabled :)
Comment on attachment 8766214 [details] [diff] [review]
fix.patch

Isn't the issue that we don't handle webkitdirectory attribute in nsFileControlFrame::CreateAnonymousContent
Attachment #8766214 - Flags: review?(bugs) → review-
Attached patch fix.patchSplinter Review
Attachment #8766214 - Attachment is obsolete: true
Attachment #8766252 - Flags: review?(bugs)
Comment on attachment 8766252 [details] [diff] [review]
fix.patch

Could you cache pref values in some bool
bool isDir =
  Preferences::GetBool("dom.input.dirpicker", false) &&
  content && content->HasAttr(kNameSpaceID_None, nsGkAtoms::directory);;
bool isWebkitDir = isDir ? false :   
  Preferences::GetBool("dom.webkitBlink.dirPicker.enabled", false) &&
  content && content->HasAttr(kNameSpaceID_None, nsGkAtoms::webkitdirectory);

and then use the bool vars and not check the pref in many places.
Attachment #8766252 - Flags: review?(bugs) → review+
Pushed by amarchesini@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/f843a97323da
HTMLInputElement.webkitdirectory should show a DirPicker, r=smaug
Backout by cbook@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/72993ec9d303
Backed out changeset f843a97323da for bustage on a CLOSED TREE
Pushed by amarchesini@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/5c839b37704c
HTMLInputElement.webkitdirectory should show a DirPicker, r=smaug
https://hg.mozilla.org/mozilla-central/rev/5c839b37704c
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla50
In order to update the docs, if I understand correctly both HTMLInputElement.webkitdirectory and file.webkitrelativepath work only in Gecko50+ instead of Gecko49.

Are there any plan to uplift this to Gecko49? (Not that I want too, just to foresee what doc update is needed)
Keywords: dev-doc-needed
We don't want uplift this patch. And everything is disabled by pref. We want to enable this feature when the Entries API is fully implemented. See bug 1284987.
Flags: needinfo?(amarchesini)
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: