Skip to content

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

Description

@onederlnd

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 <id>) — 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:

Questionnaire

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions