Expand description
Platform text-input session: soft-keyboard visibility hooks.
Platforms with an on-screen keyboard (Android, iOS, some Linux shells)
install a PlatformTextInputHandler so the framework can tell them when
editable text gains or loses focus. The text-field focus manager
(crate::text_field_focus) fires these notifications:
- a text field acquired focus → [
notify_text_input_focus_gained] →show_keyboard - focus was explicitly cleared, or the focused field left the composition →
[
notify_text_input_focus_lost] →hide_keyboard
show_keyboard fires on every focus request, including taps on an
already-focused field. This is intentional: the user may have dismissed the
keyboard (e.g. Android back gesture) without the framework knowing, and
tapping the field again must bring it back. Platform show/hide calls are
expected to be idempotent. hide_keyboard is only forwarded when the
framework previously requested the keyboard, so repeated stale-focus checks
do not spam the platform.
The handler is stored per AppContext,
like the focus state itself, so multiple app instances in one process do
not observe each other’s keyboards.
Traits§
- Platform
Text Input Handler - Callbacks a platform installs to control its on-screen keyboard.
Functions§
- clear_
platform_ text_ input_ handler - Removes the installed platform soft-keyboard handler, if any.
- notify_
app_ paused - Notifies the framework that the host app was paused (backgrounded — e.g.
Android
onPause). - notify_
app_ resumed - Notifies the framework that the host app resumed (foregrounded — e.g.
Android
onResume). - set_
platform_ text_ input_ handler - Installs the platform soft-keyboard handler for the current app context.