material-components / material-components/material-components-android
[MaterialDatePicker] Selected month is lost when app returns from background
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 17.4k
- Forks
- 3.2k
- PR merge metrics
- No merged PRs in 30d
Description
**Description:** Issue can be reproduced with Catalog app, as seen in attached recording
1. Open DatePicker, and navigate to month in the past or in the future.
2. Put app into background and then bring to foreground
3. DatePicker selection moves back to current month (or the one it was opened with initially)
**Expected behavior:** State of the component should be maintained.
The problem only happens in background/foreground use case. When device is rotated, the state is correctly maintained.
**Android API version:** Observed on multiple versions, e.g. 30 and 35.
**Material Library version:** Catalog app built from HEAD on master branch (690bbfc917b5a31f18d6285a684e39e6ef55dd6a). Also observed with 1.12.0
**Device:** Observed on multiple devices, e.g. Android emulator, Pixel 6a
As a user of my app has reported (https://github.com/mtotschnig/MyExpenses/issues/1626), this has important UX implication: User navigates to a given month, and before selecting the day, they need to verify information in a different app, and when returning to my app, the month they already have selected, is lost.
https://github.com/user-attachments/assets/9c3e3910-a345-4ec4-8a83-1153bb36f6ca
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue in the Catalog app by navigating to another month, backgrounding the app, and returning to it. Inspect MaterialDatePicker state handling around background/foreground restoration; done means the selected month remains unchanged, as it does across rotation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100