DioxusLabs / DioxusLabs/dioxus

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

Aperta Adatta ai principianti
#5,653 0 commenti 1 reazione 0 assegnatari Vedi su GitHub
bug
Lingua principale
Rust
Stelle
39.1k
Fork
1.9k
Merge medio
4g 10h
PR unite (30g)
4

Descrizione

**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,

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
android, ios, rust
Ambito
mobile-dev
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Tranquilla
Chiarezza
Specificata chiaramente
Idoneità per principianti
78/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.