From 92bb322da2429a4fcc64faf6cd4d913e86b60f6d Mon Sep 17 00:00:00 2001 From: YAFD Date: Wed, 22 Jun 2022 20:47:59 -0300 Subject: [PATCH] Mouse: Update elIsCancel to use composedPath instead of event.target 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 --- ui/widgets/mouse.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/widgets/mouse.js b/ui/widgets/mouse.js index 3608dcb79d3..e8e1c4886b8 100644 --- a/ui/widgets/mouse.js +++ b/ui/widgets/mouse.js @@ -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 ),