feat(touch-emulator): support Shadow DOM event handling (#13723)
This commit is contained in:
@@ -146,7 +146,7 @@
|
|||||||
!eventTarget ||
|
!eventTarget ||
|
||||||
(eventTarget && !eventTarget.dispatchEvent)
|
(eventTarget && !eventTarget.dispatchEvent)
|
||||||
) {
|
) {
|
||||||
eventTarget = ev.target;
|
eventTarget = ev.composed ? ev.composedPath()[0] : ev.target;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eventTarget.closest('[data-no-touch-simulate]') == null) {
|
if (eventTarget.closest('[data-no-touch-simulate]') == null) {
|
||||||
@@ -166,8 +166,11 @@
|
|||||||
* @param mouseEv
|
* @param mouseEv
|
||||||
*/
|
*/
|
||||||
function triggerTouch(eventName, mouseEv) {
|
function triggerTouch(eventName, mouseEv) {
|
||||||
var touchEvent = document.createEvent('Event');
|
var touchEvent = new Event(eventName, {
|
||||||
touchEvent.initEvent(eventName, true, true);
|
bubbles: true,
|
||||||
|
cancelable: true,
|
||||||
|
composed: true,
|
||||||
|
});
|
||||||
|
|
||||||
touchEvent.altKey = mouseEv.altKey;
|
touchEvent.altKey = mouseEv.altKey;
|
||||||
touchEvent.ctrlKey = mouseEv.ctrlKey;
|
touchEvent.ctrlKey = mouseEv.ctrlKey;
|
||||||
|
|||||||
Reference in New Issue
Block a user