Closed Bug 691796 Opened 13 years ago Closed 3 years ago

the dragstart event is not fired on a svg element

Categories

(Core :: DOM: Copy & Paste and Drag & Drop, defect, P5)

x86
Linux
defect

Tracking

()

RESOLVED INVALID

People

(Reporter: cricri.bug, Unassigned)

References

Details

Attachments

(1 file)

Load the file, try to drag the yellow rectangle, nothing will happen
If you click first on the yellow rectangle, then you will be able to drag it; click on the blue container, you will have to click the yellow rectangle another time to start a drag
Attached file repro
Attachment #564577 - Attachment mime type: text/plain → text/html
try adding

container.setAttribute("pointer-events", "none");
draggable.setAttribute("pointer-events", "all");
same bug for the first drag, then works fine (when clicking on the container, the draggable element won't loose the "focus")

but the container may have to respond to events...
I think you're getting some default behaviour from some other event. Maybe mousemove, onclick or onfocus. You may need to add a handler for one or more of these and do event.preventDefault() on them.

I don't think there's any real bug here. The browser is allowed to provide default handling for many events and your drag/drop isn't working with that default behaviour.
See bug 525591 for an alternative drag/drop solution too.
I have tried various combinaison of handlers, but unsuccessfully. Is there a way to know all the events fired by the browser ?
I will use the drag&drop old style... Thanks for your help!
There's no single source that I know of.
Component: General → Drag and Drop
Product: Firefox → Core
QA Contact: general → drag-drop
Target Milestone: Firefox 7 → ---
We only fire dragstart on selections (text, images or links), html and xul elements. I don't know if the svg spec or some other spec defines drag and drop events in svg. We could support the draggable or similar attribute on svg elements.

Or just fire dragstart on all svg elements anyway (as we do for xul). The issue with this approach is that the user action for dragging is the same as for selecting, so if it's expected that dragging with the mouse creates a selection in svg then this approach might not work.
The SVG spec does not list drag events as being fired on SVG elements: http://www.w3.org/TR/SVG/svgdom.html#RelationshipWithDOM2Events I suspect that's because the SVG specification came before drag events were thought of though.

The mouse should work in SVG the same as it does in html.
Blocks: 511188

Bulk-downgrade of unassigned, untouched DOM/Storage bug's priority.

If you have reason to believe, this is wrong, please write a comment and ni :jstutte.

Severity: normal → S4
Priority: -- → P5

According to the specification draggable applies to HTML elements only https://html.spec.whatwg.org/multipage/dnd.html#dom-draggable

Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: