Skip to content

Commit

Permalink
Restore no-op default. (#3879)
Browse files Browse the repository at this point in the history
As it stands, if there's only one non-disabled radio button, using up/down to navigate will de-select it (because the default value in 'min' is None) when navigation should do nothing (the default should be 'selected').
  • Loading branch information
rodrigogiraoserrao committed Dec 17, 2023
1 parent 32b916f commit c4e1067
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/textual/widgets/_radio_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def distance(index: int) -> int:
"""
return direction * (index - selected) % len(self.children)

self._selected = min(candidate_indices, key=distance, default=None)
self._selected = min(candidate_indices, key=distance, default=selected)

def action_toggle(self) -> None:
"""Toggle the state of the currently-selected button."""
Expand Down

0 comments on commit c4e1067

Please sign in to comment.