diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d160f28e2..ce01e8bf9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Fixed `Tree` and `DirectoryTree` horizontal scrolling off-by-2 https://github.com/Textualize/textual/pull/4744 - Fixed text-opacity in component styles https://github.com/Textualize/textual/pull/4747 - Ensure `Tree.select_node` sends `NodeSelected` message https://github.com/Textualize/textual/pull/4753 +- Fixed `CommandPalette` not focusing the input when opened when `App.AUTO_FOCUS` doesn't match the input https://github.com/Textualize/textual/pull/4763 - `SelectionList.SelectionToggled` will now be sent for each option when a bulk toggle is performed (e.g. `toggle_all`). Previously no messages were sent at all. https://github.com/Textualize/textual/pull/4759 ### Changed diff --git a/src/textual/command.py b/src/textual/command.py index 2cd523767a..10b1fbbcf6 100644 --- a/src/textual/command.py +++ b/src/textual/command.py @@ -421,6 +421,8 @@ class CommandInput(Input): class CommandPalette(SystemModalScreen[CallbackType]): """The Textual command palette.""" + AUTO_FOCUS = "CommandInput" + COMPONENT_CLASSES: ClassVar[set[str]] = { "command-palette--help-text", "command-palette--highlight",