summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikolaj Boc <mikolaj.boc@qt.io>2022-12-08 11:01:41 +0100
committerMikolaj Boc <mikolaj.boc@qt.io>2022-12-15 18:31:51 +0100
commitb13405bb34bfbb9dd090de71c9dfa1a655286324 (patch)
treede6bd96b8171ef441cded4996d62c583774f41b1
parent095604c9af90989957c974549bafdb0518c2ed3f (diff)
Always target the web events at the currentTarget
Otherwise, when the event bubbles, all of the events are targeted at the 'target', which is not the behavior we observe in browsers. For an event, the following should happen: - Targeting phase (we don't use this for firing events) - The found target should have its event handler fired - If the event's propagation is not prevented, it should bubble. All of the element's parent elements should get a chance to handle the event. These are called 'currentTarget' and this is therefore the actual element we should run the callback on. Change-Id: I6bf8903431c6dea3097a4582acad22c9a4f12469 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
-rw-r--r--src/corelib/platform/wasm/qstdweb.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/platform/wasm/qstdweb.cpp b/src/corelib/platform/wasm/qstdweb.cpp
index 69ed8fe34f..3d72481a95 100644
--- a/src/corelib/platform/wasm/qstdweb.cpp
+++ b/src/corelib/platform/wasm/qstdweb.cpp
@@ -642,7 +642,7 @@ EventCallback::EventCallback(emscripten::val element, const std::string &name, c
void EventCallback::activate(emscripten::val event)
{
- emscripten::val target = event["target"];
+ emscripten::val target = event["currentTarget"];
std::string eventName = event["type"].as<std::string>();
emscripten::val property = target[contextPropertyName(eventName)];
// This might happen when the event bubbles