diff options
author | Mikolaj Boc <mikolaj.boc@qt.io> | 2023-03-08 10:18:04 +0100 |
---|---|---|
committer | Mikolaj Boc <mikolaj.boc@qt.io> | 2023-03-28 16:31:17 +0100 |
commit | d34259d9667a621ecde0ec40bef7eec664400a44 (patch) | |
tree | 0a936e5bbedbf8b797bb627cac6d2bc7190d375f /src | |
parent | f3e27d3688014d15d7f1fd35c86cf1d9fe465ab4 (diff) |
Stop propagation and default action on WASM window pointer event
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 <piotr.wiercinski@qt.io>
Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/platforms/wasm/qwasmwindowclientarea.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/plugins/platforms/wasm/qwasmwindowclientarea.cpp b/src/plugins/platforms/wasm/qwasmwindowclientarea.cpp index e3b681adb5..c93625f78d 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<void>("preventDefault"); + processPointer(*PointerEvent::fromWeb(event)); + event.call<void>("preventDefault"); + event.call<void>("stopPropagation"); }); m_pointerDownCallback = |