Skip to content

Commit 1ac082f

Browse files
Richard Taylorclaude
authored andcommitted
SettingActivity: keep exactly one radio option selected
Clicking the already-selected radio option used to deselect it and save an empty string for the setting. This broke the invariant that a radio group always has exactly one selection: users could tap the active option, hit Save, and end up with an empty `wallet_type` (in Lightning Piggy) or any other required radio setting cleared. Re-check the target on an un-check attempt so the selection sticks. Users change their pick by clicking a different option, which is the normal radio-group convention. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
1 parent 6e415bb commit 1ac082f

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

internal_filesystem/lib/mpos/ui/setting_activity.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,15 @@ def radio_event_handler(self, event):
146146
current_checkbox_index = target_obj.get_index()
147147
print(f"current_checkbox_index: {current_checkbox_index}")
148148
if not checked:
149+
# Radio-button convention: clicking the already-selected option
150+
# must NOT un-select it. Exactly one option is always selected
151+
# once the user has made a choice. Without this guard, a user
152+
# could land on Settings, tap the current wallet type, and save
153+
# an empty wallet_type — leading to the welcome screen coming
154+
# back even though they meant to keep the config intact.
149155
if self.active_radio_index == current_checkbox_index:
150-
print(f"unchecking {current_checkbox_index}")
151-
self.active_radio_index = -1 # nothing checked
156+
print(f"radio: ignoring un-check of active option {current_checkbox_index} (radios require exactly one)")
157+
target_obj.add_state(lv.STATE.CHECKED)
152158
return
153159
else:
154160
if self.active_radio_index >= 0: # is there something to uncheck?

0 commit comments

Comments
 (0)