Skip to content

feat: add TextField text_input_action keyword - #30

Merged
AdamMusa merged 2 commits into
mainfrom
feat/text-input-action
Oct 29, 2026
Merged

AdamMusa merged 2 commits into
mainfrom
feat/text-input-action

Conversation

@AdamMusa

Copy link
Copy Markdown
Owner

Engine counterpart: AdamMusa/ruflet-engine#14

What

Adds the text_input_action keyword to TextField so a Ruby app can choose the keyboard's return key and chain fields with Next/Done.

email = text_field(label: "Email", keyboard_type: "email", text_input_action: "next")
password = text_field(
  label: "Password",
  password: true,
  text_input_action: "done",
  on_submit: ->(_e) { sign_in }
)
notes = text_field(label: "Notes", multiline: true, text_input_action: :send, on_submit: ->(e) { post(e.data) })

Keywords and events

  • New keyword text_input_action (String or Symbol; nil means the platform default). Values: done go search send next previous newline unspecified none continueAction join route emergencyCall, in camelCase or snake_case.
  • Added to the Material TextFieldControl and the legacy CupertinoTextFieldControl KEYWORDS (sorted). The platform TextFieldControl contract unions both, so text_field(...) and cupertino_text_field(...) accept it.
  • Events are unchanged: on_submit receives the text and now also fires when the keyboard moves to the next field.

Material vs Cupertino (client side, see engine PR)

Both renderers pass the action to the native field. Actions the device keyboard does not support fall back to the default: Android drops continueAction join route emergencyCall, iOS drops none previous. next/previous move focus to the adjacent field. multiline: true plus an ending action (for example done or send) submits on Return instead of inserting a newline.

Tests

test/text_input_action_compatibility_test.rb (6 runs, 19 assertions) covers:

  • text_field serializes text_input_action for strings and symbols, and omits it by default.
  • Snake and camel case values pass through unchanged (the client normalizes them).
  • The Material, Cupertino and platform-contract schemas all accept the keyword, and cupertino_text_field still emits wire type TextField.
  • Multiline plus on_submit keeps the handler.
  • A misspelled keyword still raises ArgumentError.

verify_pr.sh with the engine PR:

PASS ruby:ruflet_core                   146/146 files, 624 runs
PASS engine:ruflet flutter test         +704: All tests passed!
PASS engine:ruflet analyze              No issues found!
INFO wire-key audit                     NEW vs baseline: 0
RESULT: PASS

Accept text_input_action on the Material, Cupertino and platform
TextField schemas so Ruby can choose the keyboard return key and move
focus to the next field.
@AdamMusa
AdamMusa merged commit 6868918 into main Oct 29, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant