DioxusLabs / DioxusLabs/dioxus

[Android/iOS build] Missing context menu on Android/iOS and native text-selection toolbar

Offen Anfängerfreundlich
#5,653 0 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
bug
Vorherrschende Sprache
Rust
Sterne
39.1k
Forks
1.9k
Ø Merge
4 T. 10 Std.
Gemergte PRs (30 T.)
4

Beschreibung

**Problem**

`dioxus-desktop` defaults` disable_context_menu = !cfg!(debug_assertions)` (config.rs:117), injecting a global contextmenu → `preventDefault()` script in release builds only.
On Android/iOS, this also suppresses the native `FloatingActionMode `(cut/copy/paste/select-all toolbar) triggered by WebView text selection. Result: no copy/paste toolbar in any Dioxus mobile release APK/IPA.

**Steps To Reproduce**

Steps to reproduce the behavior:

- Create any Dioxus mobile app with a text input
- Build a release APK: dx bundle --platform android --release
- Install and long-press a text input on the device
- The cut/copy/paste/select-all floating toolbar never appears

**Expected behavior**

The native text-selection toolbar (cut/copy/paste/select-all) should appear on long-press in release builds, same as in debug.

**Screenshots**

Image

**Environment:**

- Dioxus version: 0.7.9
- Rust version: 1.91.1
- OS info: Android 15 (API 35)
- App platform: mobile (Android)

**Questionnaire**

I would like to fix and I have a solution.

**Proposed fix**

`disable_context_menu` is a desktop-only concept and should not be inherited by dioxus-mobile's Config default.
The fix is to override it to false in mobile's default config, keeping desktop behavior unchanged:

// dioxus-mobile Config::new() / Default impl
disable_context_menu: false,

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Start with dioxus-desktop's config.rs:117 and the dioxus-mobile Config::new() or Default implementation. Build a mobile release with `dx bundle --platform android --release`, verify that long-pressing a text input shows the native cut/copy/paste toolbar, and confirm desktop context-menu behavior remains unchanged.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
android, ios, rust
Bereich
mobile-dev
Issue-Typ
Bug
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Ruhig
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
78/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.