From 109b845d26f0a230e63d98c23132feb973d64a4d Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Mon, 11 Mar 2024 16:06:34 +0000 Subject: [PATCH] Stop OptionList.OptionHighlighted leaking out of Select Co-authored-by: TomJGooding <101601846+TomJGooding@users.noreply.github.com> --- CHANGELOG.md | 1 + src/textual/widgets/_select.py | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f300262eba..86899c5390 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Rename `CollapsibleTitle.action_toggle` to `action_toggle_collapsible` to fix clash with `DOMNode.action_toggle` https://github.com/Textualize/textual/pull/4221 - Markdown component classes weren't refreshed when watching for CSS https://github.com/Textualize/textual/issues/3464 - Rename `Switch.action_toggle` to `action_toggle_switch` to fix clash with `DOMNode.action_toggle` https://github.com/Textualize/textual/issues/4262 +- Fixed `OptionList.OptionHighlighted` leaking out of `Select` https://github.com/Textualize/textual/issues/4224 ### Changed diff --git a/src/textual/widgets/_select.py b/src/textual/widgets/_select.py index 0d19d4aaef..240cffe9ef 100644 --- a/src/textual/widgets/_select.py +++ b/src/textual/widgets/_select.py @@ -95,6 +95,12 @@ def on_option_list_option_selected(self, event: OptionList.OptionSelected) -> No event.stop() self.post_message(self.UpdateSelection(event.option_index)) + def on_option_list_option_highlighted( + self, event: OptionList.OptionHighlighted + ) -> None: + """Stop option list highlighted messages leaking.""" + event.stop() + class SelectCurrent(Horizontal): """Displays the currently selected option."""