diff --git a/src/plugins/platforms/wasm/qwasmevent.cpp b/src/plugins/platforms/wasm/qwasmevent.cpp index d4f9991feb7..19730c2c685 100644 --- a/src/plugins/platforms/wasm/qwasmevent.cpp +++ b/src/plugins/platforms/wasm/qwasmevent.cpp @@ -44,6 +44,14 @@ std::optional PointerEvent::fromWeb(emscripten::val event) PointerType::Mouse : PointerType::Other; ret.mouseButton = MouseEvent::buttonFromWeb(event["button"].as()); ret.mouseButtons = MouseEvent::buttonsFromWeb(event["buttons"].as()); + + // The current button state (event.buttons) may be out of sync for some PointerDown + // events where the "down" state is very brief, for example taps on Apple trackpads. + // Qt expects that the current button state is in sync with the event, so we sync + // it up here. + if (*eventType == EventType::PointerDown) + ret.mouseButtons |= ret.mouseButton; + ret.localPoint = QPoint(event["offsetX"].as(), event["offsetY"].as()); ret.pointInPage = QPoint(event["pageX"].as(), event["pageY"].as()); ret.pointInViewport = QPoint(event["clientX"].as(), event["clientY"].as());