bevyengine / bevyengine/bevy

UI Buttons not working correctly when compiled to WASM and run on phone or browser in device mode

Open
#9,116 5 comments 0 reactions 0 assignees View on GitHub
A-Input A-UI C-Bug O-Android O-Web
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## Bevy version

v0.11.0

## What you did

I initially came across this when trying to run a Bevy game on my phone.
After some testing, I've concluded that it is also happening when running in a browser if the device emulation mode is enabled in DevTools.
I'm guessing this is related to how touch inputs are handled in UI Buttons.

## What went wrong

On the original game I discovered the issue on, I only noticed that it was completely ignoring pressing UI buttons.
After some more testing, it seems like it's not really ignoring it, but the click detection zone is way off from the visual representation of the button, and depending on the location of the button potentially completely off screen and unclickable.

## Additional information

I made a minimal reproduction based on the Bevy button example. When compiled to WASM and run in a browser, with device emulation mod enabled in DevTools, you should be able to see the issue.
[bevy-ui-repro.zip](https://github.com/bevyengine/bevy/files/12018118/bevy-ui-repro.zip)

Here's a recording showing the issue.
Around the middle of the video, you can see me clicking just about in the middle between the left side of the screen and the button, and the button lighting up as if it was clicked.
https://github.com/bevyengine/bevy/assets/4687674/fd1e64c9-dbcb-4dc0-8978-f222a6f882f1

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.