Skip to content

Commit

Permalink
Mouse: Update elIsCancel to use composedPath instead of event.target
Browse files Browse the repository at this point in the history
When using web-components with shadowRoot, the mouseDown event is triggered with the event.target pointing to the entire web component, not inner nodes that were clicked, thus to cancel the mouseDown based on inner-elements we have to use composedPath instead of event.target
  • Loading branch information
malarahfelipe committed Jun 25, 2022
1 parent 3a1b590 commit b88cfde
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ui/widgets/mouse.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ return $.widget( "ui.mouse", {

this._mouseDownEvent = event;

let [ first = event.target ] = 'composedPath' in event.originalEvent && event.originalEvent.composedPath() || []
var first = (
event.originalEvent && event.originalEvent.composedPath ?
event.originalEvent.composedPath() : [ ]
)[ 0 ] || event.target;

var that = this,
btnIsLeft = ( event.which === 1 ),
Expand Down

0 comments on commit b88cfde

Please sign in to comment.