diff --git a/src/textual/widgets/_select.py b/src/textual/widgets/_select.py index 6049dd3227..ef5be915c5 100644 --- a/src/textual/widgets/_select.py +++ b/src/textual/widgets/_select.py @@ -493,7 +493,10 @@ def _on_mount(self, _event: events.Mount) -> None: def _watch_expanded(self, expanded: bool) -> None: """Display or hide overlay.""" - overlay = self.query_one(SelectOverlay) + try: + overlay = self.query_one(SelectOverlay) + except NoMatches: + return self.set_class(expanded, "-expanded") if expanded: overlay.focus()