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 23, 2022
1 parent 3a1b590 commit 92bb322
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ui/widgets/mouse.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ return $.widget( "ui.mouse", {

this._mouseDownEvent = event;

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

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

0 comments on commit 92bb322

Please sign in to comment.