From e6549ce072cfd97e8f558c8125f1b7393316cabd Mon Sep 17 00:00:00 2001 From: TomJGooding <101601846+TomJGooding@users.noreply.github.com> Date: Thu, 20 Mar 2025 17:52:08 +0000 Subject: [PATCH] fix(keys): initially focus the key log When running `textual keys`, currently the 'Clear' button will have initial focus. This can be confusing if you're trying to test the `enter` key with some modifiers, as this might invoke a button press! This simply re-orders the composed widgets so the key log is initially focussed instead. --- src/textual_dev/previews/keys.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/textual_dev/previews/keys.py b/src/textual_dev/previews/keys.py index 0af2c82..ad7f177 100644 --- a/src/textual_dev/previews/keys.py +++ b/src/textual_dev/previews/keys.py @@ -40,12 +40,12 @@ class KeysApp(App[None], inherit_bindings=False): def compose(self) -> ComposeResult: yield Header() + yield KeyLog() yield Horizontal( Button("Clear", id="clear", variant="warning"), Button("Quit", id="quit", variant="error"), id="buttons", ) - yield KeyLog() def on_ready(self) -> None: self.query_one(KeyLog).write(Panel(Text.from_markup(INSTRUCTIONS)), expand=True)