You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Android (M7): a native host on a fork, and three questions #2484
A Kotlin RuneView (SurfaceView paced by Choreographer) drives LayerHost over JNI, without winit: lifecycle and insets, touch, InputConnection text input, TalkBack through accesskit_android, the system's selection handles and toolbar, clipboard, system fonts, haptics. Each slice has host tests that fail before its change; the fork's CI cross-builds both Android targets and the APK. Checked on an API 35 emulator and a Xiaomi 14 (Android 16), where it holds 120 Hz with and without TalkBack.
I will ship one issue per slice with its gap and its test.
Three decisions on your side that would help:
File pickers. Android's picker returns content:// URIs where Tx::open_file gives paths. Copy the picked document into the app's cache and return that path, or an API that hands a reader?
El::keyboard_type(KeyboardType) (Text, Email, Url, Number, Decimal, Phone), a public API we added so a touch keyboard shows the right keys. Would you take it, and under what name? The web host's inputmode and Wayland's ContentPurpose could read it too.
Focus on a tap. On Android a finger now moves focus and selection when it lifts as a tap, not when it lands, so a scroll keeps the field's focus and the keyboard up. Should touch on the web and iOS follow?
all three are design decisions that affect shared apis or cross-platform behaviour, so they need a maintainer call before slices land:
file pickers (crates/rune/src/file_dialog.rs):Tx::open_file / save_file / open_folder return PathBuf and currently error on web and mobile. copying a content:// document into app cache lets existing PathBuf callers work for read-only picks, but leaves cache cleanup, large files, save_file, and open_folder awkward. a picked-file handle/reader api (like rfd::FileHandle, with name/read/write and optional path()) would fit both android content:// uris and web <input type="file">.
keyboard / input mode hint (crates/rune/src/el/input.rs):bridge.js currently hardcodes inputMode = 'text' and wayland's layer_shell/text_input.rs hardcodes ContentPurpose::Normal; Web: text input semantics (email/url/search/autofill), non-PNG image paste, and visualViewport menu/caret bounds #2466 also asks for web input semantics (email, url, search, numeric, tel, plus autofill hints). following html inputmode (El::input_mode(InputMode) with Text, Email, Url, Numeric, Decimal, Tel, Search, None) lines up directly with web and still maps cleanly to android InputType, ios UIKeyboardType, and wayland ContentPurpose — or El::keyboard_type(KeyboardType) if mobile naming is preferred.
focus and selection on tap-up (crates/rune/src/runtime/input/touch.rs, pointer.rs):touch_down_inner currently calls press_down on TouchPhase::Started, queueing Action::Focus / Action::Blur and press_selection before TOUCH_SLOP distinguishes a tap from a pan. web (platform/web/input.rs) already defers dom focus sync until TouchPhase::Ended, so moving touch focus/blur/selection to tap-up in shared touch.rs would keep scrolling from dismissing the keyboard across android, web, and ios alike (matching chrome, android, and uikit).
Thanks for laying out all three questions clearly — here are the design decisions for the upcoming Android slices:
1. File pickers (content:// URIs vs PathBuf)
Decision: Add a platform-neutral handle/reader API alongside the existing PathBuf methods — do not copy content:// documents into app cache behind Tx::open_file.
Copying into app cache leaves cache cleanup, eviction, and large-file copy latency awkward, and cannot cleanly handle save_file (ACTION_CREATE_DOCUMENT, which writes back through the URI's output stream) or open_folder (ACTION_OPEN_DOCUMENT_TREE).
Keep existing desktop Tx::open_file / open_files / save_file / open_folder (PathBuf) unchanged for backward compatibility, and introduce an additive handle API modelled on rfd::FileHandle / web File System Access handles (metadata such as name(), optional path() -> Option<&Path> returning Some on desktop and None on Android content:// and web, plus async/streaming read and write). That covers Android SAF, web <input type="file">, and iOS security-scoped URLs with one cross-platform shape.
Until that slice lands, Tx::open_file on Android should keep returning an unsupported error rather than staging cache copies.
2. Soft-keyboard hint (El::keyboard_type vs El::input_mode)
Decision: Yes, we want this as an additive El builder, named after HTML's inputmode: El::input_mode(InputMode) (default InputMode::Text).
Using the HTML inputmode variants (Text, None, Tel, Url, Email, Numeric, Decimal, Search) covers all six of your variants plus Search and None, pairs directly with Web: text input semantics (email/url/search/autofill), non-PNG image paste, and visualViewport menu/caret bounds #2466 on web (where autofill/credential hints remain separate from keyboard layout), and maps cleanly to Android InputType/EditorInfo, iOS UIKeyboardType, and Wayland zwp_text_input_v3::ContentPurpose.
3. Touch focus and selection on tap-up (shared across web, iOS, and Android)
Decision: Yes — deferring touch focus, blur, and text-field caret/selection to tap-up is now the shared default across all touch hosts, matching Chrome, Android, and UIKit.
Shipped in fix(touch): defer focus, blur, and selection changes to tap-up #2558 (c1860598b): Shared touch handling (runtime/input/touch_machine.rs, touch.rs, pointer.rs, selection/click.rs, plus web_touch_end_activate in input/host_events.rs) now defers focus, blur, and text-field caret/selection from TouchPhase::Started to tap-up (TouchPhase::Ended within TOUCH_SLOP). Scrolling, pinching, edge swipes, long presses, and cancelled touches leave the focused field, soft keyboard, and existing text selection untouched.
Not tested on hardware: Not yet verified on physical Android, iOS, or mobile browser devices.
Closing this design Q&A now that all three questions are decided and #3 is merged on dev. Feel free to open one issue per Android slice against these decisions, or reopen if anything in #2558 behaves unexpectedly on device!
Activity
opencodejr commentedon Nov 26, 2026
all three are design decisions that affect shared apis or cross-platform behaviour, so they need a maintainer call before slices land:
crates/rune/src/file_dialog.rs):Tx::open_file/save_file/open_folderreturnPathBufand currently error on web and mobile. copying acontent://document into app cache lets existingPathBufcallers work for read-only picks, but leaves cache cleanup, large files,save_file, andopen_folderawkward. a picked-file handle/reader api (likerfd::FileHandle, with name/read/write and optionalpath()) would fit both androidcontent://uris and web<input type="file">.crates/rune/src/el/input.rs):bridge.jscurrently hardcodesinputMode = 'text'and wayland'slayer_shell/text_input.rshardcodesContentPurpose::Normal; Web: text input semantics (email/url/search/autofill), non-PNG image paste, and visualViewport menu/caret bounds #2466 also asks for web input semantics (email,url,search,numeric,tel, plus autofill hints). following htmlinputmode(El::input_mode(InputMode)withText,Email,Url,Numeric,Decimal,Tel,Search,None) lines up directly with web and still maps cleanly to androidInputType, iosUIKeyboardType, and waylandContentPurpose— orEl::keyboard_type(KeyboardType)if mobile naming is preferred.crates/rune/src/runtime/input/touch.rs,pointer.rs):touch_down_innercurrently callspress_downonTouchPhase::Started, queueingAction::Focus/Action::Blurandpress_selectionbeforeTOUCH_SLOPdistinguishes a tap from a pan. web (platform/web/input.rs) already defers dom focus sync untilTouchPhase::Ended, so moving touch focus/blur/selection to tap-up in sharedtouch.rswould keep scrolling from dismissing the keyboard across android, web, and ios alike (matching chrome, android, and uikit).questions for maintainers:
Tx::open_fileor add a reader/handle api that also covers web, and should the text-field hint follow htmlinputmode(and pair with Web: text input semantics (email/url/search/autofill), non-PNG image paste, and visualViewport menu/caret bounds #2466) orEl::keyboard_type?runtime/input/touch.rsfor all touch hosts (android, web, ios)?Hona commentedon Nov 27, 2026
Thanks for laying out all three questions clearly — here are the design decisions for the upcoming Android slices:
1. File pickers (
content://URIs vsPathBuf)Decision: Add a platform-neutral handle/reader API alongside the existing
PathBufmethods — do not copycontent://documents into app cache behindTx::open_file.save_file(ACTION_CREATE_DOCUMENT, which writes back through the URI's output stream) oropen_folder(ACTION_OPEN_DOCUMENT_TREE).Tx::open_file/open_files/save_file/open_folder(PathBuf) unchanged for backward compatibility, and introduce an additive handle API modelled onrfd::FileHandle/ web File System Access handles (metadata such asname(), optionalpath() -> Option<&Path>returningSomeon desktop andNoneon Androidcontent://and web, plus async/streaming read and write). That covers Android SAF, web<input type="file">, and iOS security-scoped URLs with one cross-platform shape.Tx::open_fileon Android should keep returning an unsupported error rather than staging cache copies.2. Soft-keyboard hint (
El::keyboard_typevsEl::input_mode)Decision: Yes, we want this as an additive
Elbuilder, named after HTML'sinputmode:El::input_mode(InputMode)(defaultInputMode::Text).El::live_region,El::has_popup,El::orientation,El::auto_complete,El::spellcheck,El::read_only,El::single_line).inputmodevariants (Text,None,Tel,Url,Email,Numeric,Decimal,Search) covers all six of your variants plusSearchandNone, pairs directly with Web: text input semantics (email/url/search/autofill), non-PNG image paste, and visualViewport menu/caret bounds #2466 on web (where autofill/credential hints remain separate from keyboard layout), and maps cleanly to AndroidInputType/EditorInfo, iOSUIKeyboardType, and Waylandzwp_text_input_v3::ContentPurpose.3. Touch focus and selection on tap-up (shared across web, iOS, and Android)
Decision: Yes — deferring touch focus, blur, and text-field caret/selection to tap-up is now the shared default across all touch hosts, matching Chrome, Android, and UIKit.
c1860598b): Shared touch handling (runtime/input/touch_machine.rs,touch.rs,pointer.rs,selection/click.rs, plusweb_touch_end_activateininput/host_events.rs) now defers focus, blur, and text-field caret/selection fromTouchPhase::Startedto tap-up (TouchPhase::EndedwithinTOUCH_SLOP). Scrolling, pinching, edge swipes, long presses, and cancelled touches leave the focused field, soft keyboard, and existing text selection untouched.cargo test -p rune --lib -- runtime::input::touch input::host_events runtime::input::focus_key runtime::input::field_menu runtime::tests::press_pointer: 83 passed;cargo test -p rune --test integration -- link_drag: 6 passed) andcargo check -p rune --target wasm32-unknown-unknown.Closing this design Q&A now that all three questions are decided and #3 is merged on
dev. Feel free to open one issue per Android slice against these decisions, or reopen if anything in #2558 behaves unexpectedly on device!