From d34259d9667a621ecde0ec40bef7eec664400a44 Mon Sep 17 00:00:00 2001 From: Mikolaj Boc Date: Wed, 8 Mar 2023 10:18:04 +0100 Subject: [PATCH] Stop propagation and default action on WASM window pointer event MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The windows should not let events through to targets below (unless they are Qt::WindowTransparentForInput, which is handled independently). Therefore, stopPropagation and preventDefault are now called regardless of whether the window has handled the event or not. If the event is not handled explicitly, we still consume the DOM event so that the windows/elements below don't get focus by mistake. Fixes: QTBUG-111706 Change-Id: Idc78ac5076e97992d9f6f13a1fa574d0df4178ac Reviewed-by: Piotr Wierciński Reviewed-by: Aleksandr Reviakin Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/wasm/qwasmwindowclientarea.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wasm/qwasmwindowclientarea.cpp b/src/plugins/platforms/wasm/qwasmwindowclientarea.cpp index e3b681adb5e..c93625f78d2 100644 --- a/src/plugins/platforms/wasm/qwasmwindowclientarea.cpp +++ b/src/plugins/platforms/wasm/qwasmwindowclientarea.cpp @@ -19,8 +19,9 @@ ClientArea::ClientArea(QWasmWindow *window, QWasmScreen *screen, emscripten::val : m_screen(screen), m_window(window), m_element(element) { const auto callback = std::function([this](emscripten::val event) { - if (processPointer(*PointerEvent::fromWeb(event))) - event.call("preventDefault"); + processPointer(*PointerEvent::fromWeb(event)); + event.call("preventDefault"); + event.call("stopPropagation"); }); m_pointerDownCallback =