From d488b2408aba23e89f6540e826f9d96f875c6e19 Mon Sep 17 00:00:00 2001 From: martinRenou Date: Mon, 20 Sep 2021 11:01:57 +0200 Subject: [PATCH] Select: Do not force a selection if there is currently no selection and the options list changes --- ipywidgets/widgets/widget_selection.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ipywidgets/widgets/widget_selection.py b/ipywidgets/widgets/widget_selection.py index ac328eb6bd..36843c6490 100644 --- a/ipywidgets/widgets/widget_selection.py +++ b/ipywidgets/widgets/widget_selection.py @@ -197,6 +197,12 @@ def _propagate_options(self, change): options = self._options_full self.set_trait('_options_labels', tuple(i[0] for i in options)) self._options_values = tuple(i[1] for i in options) + + if self.index is None: + # Do nothing, we don't want to force a selection if + # the options list changed + return + if self._initializing_traits_ is not True: if len(options) > 0: if self.index == 0: