feature: submit-label prop for the return key / IME action - #69
Open
SRWieZ wants to merge 1 commit into
Open
Conversation
Forms with several fields need the platform Next/Go/Search/Send key, but the submit key face was out of reach: hardcoded on iOS (.done when @submit is wired, .return otherwise) and never set on Android (keyboardOptionsFor omitted imeAction entirely). Adds an opt-in submit-label prop (next|done|go|search|send|return) to the three text inputs, mapping to SwiftUI SubmitLabel and Compose ImeAction. Unset keeps each platform's behaviour byte-for-byte. Multiline fields ignore the prop on both platforms — their return key must keep inserting newlines. The filled/outlined Android renderers move from KeyboardActions(onDone) to onAny (the bare renderer's existing shape): with a non-Done IME action an onDone-only handler would silently drop the @submit dispatch. For the default action the two are equivalent. The fluent submitLabel() validates and throws on unknown values; Blade accepts submit-label and submitLabel.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's wrong
Donewhen@submitis wired,Returnotherwise (NativeUITextInputCore.swift); on AndroidkeyboardOptionsFornever sets an IME action. So a multi-field form can't show the platform Next/Go/Search/Send affordance.What this does
submit-labelprop (next | done | go | search | send | return) to the three text inputs, mapping to SwiftUISubmitLabelon iOS and ComposeImeActionon Android. Blade takessubmit-labelorsubmitLabel; the fluent->submitLabel()validates and throws on unknown values.KeyboardActions(onDone)toonAny(the bare renderer's existing shape) — with a non-Done IME action, an onDone-only handler would silently drop the@submitdispatch. For the default action the two are equivalent..submitLabelon a vertical-axis TextField would replace that — same territory as fix(ios): multiline inputs must insert a newline on every keyboard #42).Unset keeps each platform's behaviour byte-for-byte.
returnis iOS vocabulary (a plain Return key); Android renders its IME default for it. The bare input picks the label up through the sharedkeyboardOptionsForas soon as #51 lands (bare doesn't apply keyboard options today).Before / after (same Blade)
Android emulator, API 36 — the action key goes from the generic checkmark to Next; the numeric field (
keyboard="number" submit-label="done") shows the number pad with a Done key:iOS simulator, iPhone 17 (26.5) — the return key goes from
returntonext(iOS 26 renders the labels as glyphs):The "after" builds also carry the follow-up focus-chaining branch; the key face goes through the same
resolveImeAction/resolveSubmitLabelpath either way.Happy to PR the matching lines to the
text-inputdocs page once the API is agreed.