DetailedList on Windows has issue with get selection
- Dominant language
- Python
- Stars
- 5.4k
- Forks
- 827
- Avg merge
- 9h 45m
- Merged PRs (30d)
- 58
Description
### Describe the bug
Getting the selection of DetailedList on Windows can cause error.
### How to reproduce the bug
1. Set some data, e.g 10 items
2. Select item 7
3. Set some smaller data, e.g. 3 items
4. Get the selection -> index error
The problem is that the selected index remains when new data is set. Normally, this is not a problem and the same index stays selected on the new data.
I think, we should deselect all items when new data is set.
### Minimum example code
```shell
```
### Screenshots
_No response_
### Environment details
- Operating system and version: Windows 11
- Python version: 3.12
- Software versions:
- Toga: 0.5.7
### Logs
```
```
### Additional context
_No response_
Contributor guide
Research direction
Start with DetailedList's selection handling and reproduce the Windows case by selecting item 7, replacing 10 items with 3, and reading the selection. Trace how the selected index is retained when data changes. Done means shrinking the data no longer causes an index error and the selection is safely cleared or updated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100