android / android/nowinandroid

[FR]: Retain states of SearchTextField after configuration changes

Open
#1,033 0 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Kotlin
Stars
21.8k
Forks
4.6k
Avg merge
19h 20m
Merged PRs (30d)
2

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Describe the problem

Unlike `EditText` in Android Views, `TextField` in Compose doesn’t automatically retain or restore its states as the device goes through configuration changes such as rotating the device between landscape and portrait orientations, folding / unfolding the device, resizing window, switching dark mode, etc.
Currently, the app opens keyboard after configuration changed even when a user hid the keyboard by tapping back button or 'search' key. Also, position of cursor is not retained after the event.

This is also to find out good solution for this public issue on Compose: https://issuetracker.google.com/192776771

### Describe the solution

I suggest to implement equivalent experiences with EditText, by retaining the following after configuration changes:
- Position of cursor
- Text selection
- Focus
- Keyboard visibility

### Additional context

_No response_

### Code of Conduct

- [X] I agree to follow this project's Code of Conduct

Contributor guide

Open the contributing guide

Research direction

Start by locating the SearchTextField entry point and review how its TextField state behaves across the configuration changes listed in the issue. Compare the requested behavior with Android EditText and the linked Compose issue, then verify that cursor position, selection, focus, and keyboard visibility are retained after each change.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
mobile
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.