From b88cfdef2cfc4eebd5f0170ddeb7fa0bdd1229ef 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 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/widgets/mouse.js b/ui/widgets/mouse.js index 3608dcb79d3..d3c0db4ba91 100644 --- a/ui/widgets/mouse.js +++ b/ui/widgets/mouse.js @@ -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 ),