the dragstart event is not fired on a svg element

UNCONFIRMED
Unassigned

Status

()

Core
Drag and Drop
UNCONFIRMED
6 years ago
5 years ago

People

(Reporter: Christophe, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

1.19 KB, text/html
Details
(Reporter)

Description

6 years ago
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
(Reporter)

Comment 1

6 years ago
Created attachment 564577 [details]
repro
Attachment #564577 - Attachment mime type: text/plain → text/html
try adding

container.setAttribute("pointer-events", "none");
draggable.setAttribute("pointer-events", "all");
(Reporter)

Comment 3

6 years ago
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.
(Reporter)

Comment 6

6 years ago
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 → ---

Comment 8

6 years ago
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.

Updated

5 years ago
Blocks: 511188
You need to log in before you can comment on or make changes to this bug.