Skip to content

Commit

Permalink
Ensure input is focused when command palette launches (#4763)
Browse files Browse the repository at this point in the history
* Ensure input is focused when command palette launches

* Update changelog

* Use AUTO_FOCUS to focus the CommandInput in the CommandPalette
  • Loading branch information
darrenburns authored Jul 17, 2024
1 parent 90bbde8 commit 433d78f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/textual/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 433d78f

Please sign in to comment.