Skip to content

Commit

Permalink
Blur filter text input in table component on select (#137)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakemalachowski authored Nov 18, 2024
1 parent 68c5b30 commit d791f11
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/tui/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ func (t *Table[T]) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
case tea.KeyMsg:
switch msg.String() {
case "enter":
// The table component doesn't expose a function to blur the filter input. We set the filter input
// value to the current filter value to blur it instead.
t.Model = t.Model.WithFilterInputValue(t.Model.GetCurrentFilter())
return t, t.onSelect([]table.Row{t.Model.HighlightedRow()})
default:
if !t.Model.GetIsFilterInputFocused() {
Expand Down

0 comments on commit d791f11

Please sign in to comment.