Tails Cloner Combobox should not lose its selection when there is a change to the source or drives.
Problem:
With two or more USB sticks, if an action such as changing the source for the clone, adding a drive, removing a drive causes the list to be repopulated the last target USB stick selection is lost for the first of the list. This could cause inadvertently wiping the wrong device since their selection changed without notifying the user or grabbing focus.
Expectation:
If the last selected USB stick is still in the list after it is repopulated, it should remain selected. If I removed that USB stick or it's too small for backup #20064 after checking Clone Persistent Storage then it can reset to the top of the list and grab focus (if more than 1 remain) as the user's next action will need to be selecting among the remaining USB sticks.
Grabbing focus of the combobox helps select as Enter makes the full list drop down and the arrow keys change the selection.
The combobox should NOT grab focus if:
- there are no new USB sticks in the target list, or
- only 1 USB stick remains in target list
The combobox should grab focus if:
- 2 or more USB sticks remain in the target list, and either
- a new target appears in the list, or
- the last selection is removed from the list
More details:
I solved this bug in order to solve #6878 in a way that made sense in MR !1315. They are combined to avoid creating a conflict separating both improvements as they fight over focus.
Closing MR: !1315 (diffs)