Closed Bug 851103 Opened 11 years ago Closed 3 years ago

Drag and dropped elements like links remain :active

Categories

(Core :: DOM: UI Events & Focus Handling, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 379272

People

(Reporter: jimm, Unassigned)

References

Details

Attachments

(2 files, 1 obsolete file)

Odd rendering bug I ran across today in bugzilla.

str:

1) open up any page with standard text links (bugzilla bugs work)
2) click down on a text link and drag the link off of itself a bit
3) release the mouse

the original link text will be rendered as normal text, rather than as a link.

4) click anywhere on the page to set focus

link text returns.
This is not working for me with a simple test page:

  data:text/html,<a href="http://web.mit.edu/something">aaa

I do see it with Bugzilla, but that might be a matter of the :active styling in the Bugzilla stylesheets...
Ah, maybe this is a bugzilla 4.2 regression. I've tried a couple different sites and can't reproduce either.
Product: Core → bugzilla.mozilla.org
Version: Trunk → Production
The cause is:

    a:active {
        color: #000;
    }

from skins/standard/global.css

This is actually a Bugzilla issue (not BMO-specific).
OS: Windows 7 → All
Hardware: x86_64 → All
Whiteboard: DUPEME
It sounds like a Firefox bug then. A link shouldn't stay 'active' after it's been dragged and released, should it?

It works as expected in Firefox nightlies before 2010-10-29 (the link changes back to the 'normal' styling when the mouse button is released).

Last good nightly: 2010-10-28
First bad nightly: 2010-10-29

Pushlog:
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=fe4898e97431&tochange=799a83ba5f86

There's also a different bug, relating to the styling of the link *while it's being dragged* (before releasing the mouse button): 

Sometimes both the original and the dragged copy will be blue.
Sometimes both the original and the dragged copy will be black.
Sometimes the original will be black but the dragged copy will be blue.
Attached file testcase
Attachment #725868 - Attachment mime type: text/plain → text/html
The obvious thing in that range is bug 606192.
Blocks: 606192
No longer blocks: bmo_4_2_regressions
Component: General → Event Handling
Product: bugzilla.mozilla.org → Core
Version: Production → unspecified
As pointed out by mjh563, could bug 865409 be caused by the same thing?
Blocks: 865409
Attached patch tentative patch (obsolete) — Splinter Review
This one-line patch fixes the issue on my Linux build without breaking anything obvious. I don't really understand the code enough to know why though.

The line removed by the patch was added in the fix for bug 606192.
Attachment #758884 - Flags: review?(bugs)
Review coming by the end of this week.
Comment on attachment 758884 [details] [diff] [review]
tentative patch

I don't think we want this.
Could you try SetActiveManager(nullptr, nullptr)
Attachment #758884 - Flags: review?(bugs) → review-
Smaug, thanks for the review.

Your suggestion works to clear the active content, except that it clears it when dragging starts, not when it ends. I think it should be cleared at the end of the drag instead.

So maybe something like this patch would work? What do you think?
Attachment #758884 - Attachment is obsolete: true
Attachment #778999 - Flags: feedback?(bugs)
Comment on attachment 778999 [details] [diff] [review]
tentative patch 2

Ah, this might work.
Could you write some tests. I know testing dnd can be tricky, but we really
tests for this.
Attachment #778999 - Flags: feedback?(bugs) → feedback+
I tried creating a mochitest to drag and drop a link, but I couldn't get it to work properly. The mousedown and mousemove started the drag as expected, but the mouseup event never triggered the drop, so the test ended with the drag still in progress.

I'll have another attempt and attach the results, and hopefully you'll be able to point out where I'm going wrong.
Unfortunately I'm not making any progress with writing tests for this. If someone else wants to take it over, please do.
Component: Event Handling → User events and focus handling
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → DUPLICATE
Summary: drag and dropped links lose their "link look" → Drag and dropped elements like links remain :active
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: