Closed Bug 296872 Opened 19 years ago Closed 7 years ago

Dragging & dropping text from a link into the Find text box copies link location and not text

Categories

(Toolkit :: Find Toolbar, defect, P5)

defect

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: jorgev, Unassigned)

References

Details

Attachments

(1 file, 2 obsolete files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4

When I drag and drop text from a link into the find bar, the URL that
corresponds to the link is copied into the textbox, instead of the selected
text. This is inconsistent with the rest of the page, where you can select any
text and drag it into the find bar, copying the actual text.

Reproducible: Always

Steps to Reproduce:
1. Go to any page with links.
2. Select all (or part) of the text in the link.
3. Open the Find bar (Ctrl+F).
4. Drag and drop the text into the Find bar.

Actual Results:  
The URL of the link is copied into the Find textbox.

Expected Results:  
The selected text is copied into the Find textbox.
I can sometimes reproduce this, but not always. If I start selecting text to the
far left of a link (with some space) I can get the text to be copied. But if I
start selecting directly next to the link then I usually get the URL.
Yes, if any text besides the one in the link is selected, the text is copied. If
the selection is entirely contained in the link text, then the URL is copied
instead of the text. 
Depends on Bug 296827 since it requires a DND observer.
Depends on: 296827
Attached patch Patch V1 (obsolete) — Splinter Review
This patch depends on patch 185838 which adds the DND observer, particularly
the getSupportedFlavors function. Basically I added a new flavor:
"text/unicode-2" which handles the selected text rather than the link location.
This could work for the search bar and other text fields which don't need URLs
but the selected text instead.
I haven't tested this patch since I'm unable to compile the source due to the
crappiness of my gear :(.
I cannot reproduce this issue using a current trunk build.  Is this a branch
only issue?
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b2) Gecko/20050619
Firefox/1.0+
No, I can reproduce this on Deer Park. Perhaps the steps to reproduce aren't clear:
1. Open any HTML page with links (<a> tags).
2. Select the text in any anchor on the page, for instance the 'reply' on the
header of this comment. Select _only_ letters in the anchor. Do not include the
[] or any other surrounding text.
3. Open the Find bar (Ctrl+F).
4. Drag and drop the text into the Find bar.

Actual Results:  
The URL of the link is copied into the Find textbox.

Expected Results:  
The selected text is copied into the Find textbox.
(In reply to comment #6)

> 4. Drag and drop the text into the Find bar.

Ah, I see the issue now.  It only fails with drag and drop.  Copy/paste works
just fine.

Confirming.
Status: UNCONFIRMED → NEW
Ever confirmed: true
+      // XXXBlake Workaround caret crash when you try to set the textbox's
value on dropping
+      setTimeout(function(u) { findField.value = u; find(u); }, 0, aXferData.data);
This workaround is not necessary anymore since bug 296464 got fixed.
As per comment #8, timeout workaround has been removed.
Attachment #186704 - Attachment is obsolete: true
With Bug 296827 fixed, I think this patch is ready for review. What's most
important to decide is the name for the new flavour. I chose "text/unicode-2",
which might not be the best name.
Attachment #196462 - Attachment is obsolete: true
Attachment #196918 - Flags: review?(mconnor)
Comment on attachment 196918 [details] [diff] [review]
Patch V3 - Updated after fix of Bug 296827

moa=me for the toolkit parts, but the widget/content stuff should be reviewed by an appropriate peer (and I'm pretty sure this isn't branch-safe_
Attachment #196918 - Flags: review?(mconnor)
Product: Firefox → Toolkit
Since the avent of Paste & Search in the searchbar, this has become a major problem since it is now normal expected behavior to be able to drag text into the searchbar and instantly get search results.
Priority: -- → P5
No longer blocks: 1297842
This seems to be fixed on Nightly now.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: