From 12df4721bf212b51481c5bf5e86440b36908a676 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..0d927e89c0f 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 = ( + event.originalEvent && event.originalEvent.composedPath ? event.originalEvent.composedPath() : [ ] + )[ 0 ] || event.target; var that = this, btnIsLeft = ( event.which === 1 ),