Skip to content

Commit 5ce5f07

Browse files
wesmclaude
andcommitted
fix: Prevent Enter key propagation from filter modal to main view
Fixed event propagation issue where pressing Enter in the filter modal would both apply filters AND trigger drill-down action in the main view. **Issue**: After pressing Enter to apply filters, app would immediately drill down into the first row of the table. **Root Cause**: Enter key event was not stopped, so it bubbled up from the modal to the main app's on_data_table_row_selected handler. **Fix**: Added event.stop() calls to ALL keyboard shortcuts in FilterScreen: - Enter/Space: Stop before applying filters - Escape: Stop before dismissing - h: Stop before toggling hidden checkbox - t: Stop before toggling transfers checkbox **This is a common Textual pattern**: Modal screens must stop key events to prevent them from reaching parent widgets. **Affected Workflow:** 1. User presses 'f' to open filters 2. User presses 'h' or 't' to toggle options 3. User presses Enter to apply 4. Before: Would drill down immediately 5. After: Cleanly dismisses modal, no drill-down All 465 tests passing, pyright clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 0ec6ba9 commit 5ce5f07

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

moneyflow/screens/credential_screens.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,17 +591,21 @@ async def on_button_pressed(self, event: Button.Pressed) -> None:
591591
def on_key(self, event: Key) -> None:
592592
"""Handle keyboard shortcuts for filter modal."""
593593
if event.key == "escape":
594+
event.stop() # Prevent propagation
594595
self.dismiss(None)
595596
elif event.key in ("enter", "space"):
597+
event.stop() # Prevent propagation to parent
596598
# Apply filters
597599
show_hidden = self.query_one("#show-hidden-checkbox", Checkbox).value
598600
show_transfers = self.query_one("#show-transfers-checkbox", Checkbox).value
599601
self.dismiss({"show_hidden": show_hidden, "show_transfers": show_transfers})
600602
elif event.key == "h":
603+
event.stop() # Prevent propagation
601604
# Toggle hidden checkbox
602605
checkbox = self.query_one("#show-hidden-checkbox", Checkbox)
603606
checkbox.value = not checkbox.value
604607
elif event.key == "t":
608+
event.stop() # Prevent propagation
605609
# Toggle transfers checkbox
606610
checkbox = self.query_one("#show-transfers-checkbox", Checkbox)
607611
checkbox.value = not checkbox.value

0 commit comments

Comments
 (0)