Opened 6 years ago

Last modified 2 years ago

#16157 assigned defect

dnd: replace evt.stop with evt.preventDefault in Selector.onMouseDown

Reported by: Simon Speich Owned by: dylan
Priority: undecided Milestone: 1.15
Component: DnD Version: 1.8.1
Keywords: Cc:
Blocked By: Blocking:

Description

dnd.Selector.onMouseDown() calls event.stop(e) on line 268/196 (to prevent the browser from selecting text when the user drags?).

But this prevents using the event mousedown higher up in the DOM hierarchy (e.g. event delegation) and should therefore be replaced with event.preventDefault() instead, which does not cancel the bubbling up. Also see fixed ticket #13994.

Change History (5)

comment:1 Changed 5 years ago by bill

#16805 is a duplicate of this ticket.

comment:2 Changed 5 years ago by Simon Speich

Workaround:

define([
	'dojo/_base/declare',
	'dojo/on',
	'dojo/dnd/Selector'
], function(declare, on, Selector) {

	return declare([Selector], {

		onMouseDown: function(evt) {
			// onMouseDown calls stopPropagation(), which prevents setting context
			// -> add it back with emit()
			this.inherited('onMouseDown', arguments);
			on.emit(evt.target, 'mousedown', {
				bubbles: true,
				cancelable: true
			});
		}
	});
});

and then use map property in dojoConfig:

var dojoConfig = {
	map: {
		'dojo/dnd': {
			'dojo/dnd/Selector': 'yourOwnModule/dnd/Selector'
		}
	}
};

comment:3 Changed 5 years ago by bill

#17606 is a duplicate of this ticket.

comment:4 Changed 3 years ago by dylan

Milestone: tbd1.12
Owner: changed from Eugene Lazutkin to dylan
Status: newassigned

comment:5 Changed 2 years ago by dylan

Milestone: 1.131.15

Ticket planning... move current 1.13 tickets out to 1.15 to make it easier to move tickets into the 1.13 milestone.

Note: See TracTickets for help on using tickets.