Bug 13897 - Dragging a file onto <input type="file"> should give distinct visual feedback
Summary: Dragging a file onto <input type="file"> should give distinct visual feedback
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: 523.x (Safari 3)
Hardware: Macintosh OS X 10.4
: P2 Normal
Assignee: Jon Lee
URL: http://trac.webkit.org/projects/webki...
Keywords: InRadar
: 15753 17024 32493 (view as bug list)
Depends on: 71324 71325
Blocks: 78587
  Show dependency treegraph
 
Reported: 2007-05-28 06:12 PDT by David Kilzer (:ddkilzer)
Modified: 2012-02-14 01:17 PST (History)
10 users (show)

See Also:


Attachments
Patch (9.29 KB, patch)
2011-11-04 16:36 PDT, Jon Lee
no flags Details | Formatted Diff | Diff
Patch (9.30 KB, patch)
2011-11-05 10:02 PDT, Jon Lee
mitz: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2007-05-28 06:12:37 PDT
When dragging files onto an <input type="file"> element, visual feedback is required so that the user knows where to drop the file so that it will be set as the file upload path instead of being opened in the browser.

Regarding visual feedback, I think either a cursor change or a focus ring around the input element (or both) would be sufficient.

See:  <rdar://problem/4728842> Can't drag-and-drop files onto <input type="file">
Comment 1 David Kilzer (:ddkilzer) 2007-05-28 06:14:17 PDT
<rdar://problem/5232483>

Comment 2 mitz 2007-05-28 06:34:39 PDT
The previous implementation applied a tint to the background of the control when it was being targeted.
Comment 3 Oliver Hunt 2007-05-28 15:38:14 PDT
I see a (+) cursor when i drag a file over the input.

But yes, it would probably help if there was some kind of feedback that was more distinguishable
Comment 4 David Kilzer (:ddkilzer) 2007-05-28 15:42:13 PDT
(In reply to comment #3)
> I see a (+) cursor when i drag a file over the input.

That's true for any document type that Safari will accept, like an image or HTML.  The (+) cursor starts when you enter the page boundary, not when you get to the input element, so you don't know what will happen when you drop it.  :(

Comment 5 David Kilzer (:ddkilzer) 2007-10-29 21:19:48 PDT
*** Bug 15753 has been marked as a duplicate of this bug. ***
Comment 6 Eric Seidel (no email) 2008-02-18 11:24:25 PST
When I initially added type=file drops, it drew a focus ring.  it was a bit strange looking on some sites, but it worked.  That support was lost when forms moved out of NSViews, it seems.
Comment 7 David Kilzer (:ddkilzer) 2008-02-20 07:47:25 PST
*** Bug 17024 has been marked as a duplicate of this bug. ***
Comment 8 Alexey Proskuryakov 2009-12-14 15:49:39 PST
*** Bug 32493 has been marked as a duplicate of this bug. ***
Comment 9 Jon Lee 2011-09-30 16:02:30 PDT
<rdar://problem/5232483>
Comment 10 Jon Lee 2011-11-01 14:38:08 PDT
Split out some tasks for the multiple file case. This bug can track the single file drag case.
Comment 11 Jon Lee 2011-11-04 16:36:53 PDT
Created attachment 113733 [details]
Patch
Comment 12 mitz 2011-11-04 16:50:44 PDT
Comment on attachment 113733 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=113733&action=review

r- because of the potential stale pointer issue. Other than that I think the patch is okay!

> Source/WebCore/page/DragController.h:121
> +        HTMLInputElement* m_fileInputElementUnderMouse;

I am not convinced that using a raw pointer here is safe. For example, it seems like a script could remove the element from the document while the user is dragging.
Comment 13 Jon Lee 2011-11-05 10:02:52 PDT
Created attachment 113757 [details]
Patch
Comment 14 mitz 2011-11-05 11:06:07 PDT
Comment on attachment 113757 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=113757&action=review

> Source/WebCore/page/DragController.cpp:91
> +    , m_fileInputElementUnderMouse(0)

No need to initialize a RefPtr to 0.
Comment 15 Jon Lee 2011-11-05 21:27:57 PDT
Committed r99369: <http://trac.webkit.org/changeset/99369>