mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Override _remove_option to update the selected values
The developer could remove an option that is selected, so we need to catch that this has happened and update the collection of selected values.
This commit is contained in:
@@ -410,3 +410,7 @@ class SelectionList(Generic[SelectionType], OptionList):
|
|||||||
|
|
||||||
def get_option(self, option_id: str) -> Selection[SelectionType]:
|
def get_option(self, option_id: str) -> Selection[SelectionType]:
|
||||||
return cast("Selection[SelectionType]", super().get_option(option_id))
|
return cast("Selection[SelectionType]", super().get_option(option_id))
|
||||||
|
|
||||||
|
def _remove_option(self, index: int) -> None:
|
||||||
|
self._deselect(self.get_option_at_index(index).value)
|
||||||
|
return super()._remove_option(index)
|
||||||
|
|||||||
Reference in New Issue
Block a user