Skip to content

Commit 433d78f

Browse files
authored
Ensure input is focused when command palette launches (#4763)
* Ensure input is focused when command palette launches * Update changelog * Use AUTO_FOCUS to focus the CommandInput in the CommandPalette
1 parent 90bbde8 commit 433d78f

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
2929
- Fixed `Tree` and `DirectoryTree` horizontal scrolling off-by-2 https://github.com/Textualize/textual/pull/4744
3030
- Fixed text-opacity in component styles https://github.com/Textualize/textual/pull/4747
3131
- Ensure `Tree.select_node` sends `NodeSelected` message https://github.com/Textualize/textual/pull/4753
32+
- Fixed `CommandPalette` not focusing the input when opened when `App.AUTO_FOCUS` doesn't match the input https://github.com/Textualize/textual/pull/4763
3233
- `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
3334

3435
### Changed

src/textual/command.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,8 @@ class CommandInput(Input):
421421
class CommandPalette(SystemModalScreen[CallbackType]):
422422
"""The Textual command palette."""
423423

424+
AUTO_FOCUS = "CommandInput"
425+
424426
COMPONENT_CLASSES: ClassVar[set[str]] = {
425427
"command-palette--help-text",
426428
"command-palette--highlight",

0 commit comments

Comments
 (0)