DioxusLabs / DioxusLabs/dioxus

Android: button onclick handlers don't fire (desktop works, oninput works)

Open
#5,786 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
39.1k
Forks
1.9k
Avg merge
4d 10h
Merged PRs (30d)
4

Description

**Problem**
`onclick` handlers on `button` elements do not fire on Android (both emulator and a physical device), while identical code works correctly on desktop. No errors are logged anywhere — not in the Rust process, not in the Android WebView's JS console (confirmed via `chrome://inspect/#devices` remote DevTools inspection). Manually clicking the button from within DevTools' Elements panel also does not trigger the handler, ruling out a touch/gesture-specific cause.

**Steps To Reproduce**
- Scaffold a new Dioxus app with `dx new` (mobile + desktop targets)
- Add a `button` element at the top level of the root component's `rsx!` (not nested inside any `match`, `if`, or `for`), with an `onclick` handler that does something observable, e.g. `onclick: move |_| println!("clicked")`
- Run on desktop: `dx serve --platform desktop` — click the button — the `println!` fires correctly
- Run on Android: `dx serve --platform android` (tested against both an emulator and a physical Pixel device via `--device `) — tap the button — nothing is printed, no errors anywhere
- Confirmed `oninput` handlers on `input` elements *do* work correctly on Android (typed text updates a signal displayed elsewhere on screen), isolating the issue to click/button events specifically, not the event bridge as a whole
- Confirmed via `chrome://inspect/#devices` that the button renders correctly in the DOM, and manually clicking it from DevTools also does not fire the handler, with no console errors
- Ruled out a `dx`/`dioxus` version mismatch as the cause: initially had `dioxus = "0.8.0-alpha.1"` in Cargo.toml against `dx` CLI 0.7.10, which `dx` itself flagged as incompatible ("dx and dioxus versions are incompatible!"); pinning `dioxus` to `0.7.10` to match resolved the version-mismatch warning but did not resolve the button issue

**Expected behavior**
Tapping the button on Android should fire the `onclick` handler, the same as it does on desktop with identical code.

**Screenshots**
N/A

**Environment:**
- Dioxus version: 0.7.10
- Rust version: rustc 1.97.1 (8bab26f4f 2026-07-14)
- OS info:
PRETTY_NAME="Zorin OS 17.3"
NAME="Zorin OS"
VERSION_ID="17"
VERSION="17.3"
VERSION_CODENAME=jammy
ID=zorin
ID_LIKE="ubuntu debian"
HOME_URL="https://zorin.com/os/"
SUPPORT_URL="https://help.zorin.com/"
BUG_REPORT_URL="https://zorin.com/os/feedback/"
PRIVACY_POLICY_URL="https://zorin.com/legal/privacy/"
UBUNTU_CODENAME=jammy

- App platform: Android (emulator and physical Pixel device, both via `dx serve --platform android`)

**Questionnaire**

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the issue with a top-level button in a new Dioxus app using `dx serve --platform android`, and compare it with `dx serve --platform desktop`. Inspect the Android event path after confirming that `oninput` works while `onclick` does not. Done means the button handler fires on both an emulator and a physical Android device without errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, rust
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.