diff --git a/internal/ui/model/ui.go b/internal/ui/model/ui.go index 0f59e10bee7a6c7ed3a12ef2edae8cf74f5de5d6..78846fd86c2f271f1293290e126ea7e5d1c73b87 100644 --- a/internal/ui/model/ui.go +++ b/internal/ui/model/ui.go @@ -497,6 +497,11 @@ func (m *UI) Update(msg tea.Msg) (tea.Model, tea.Cmd) { case copyChatHighlightMsg: cmds = append(cmds, m.copyChatHighlight()) case tea.MouseClickMsg: + // Pass mouse events to dialogs first if any are open. + if m.dialog.HasDialogs() { + m.dialog.Update(msg) + return m, tea.Batch(cmds...) + } switch m.state { case uiChat: x, y := msg.X, msg.Y @@ -509,6 +514,12 @@ func (m *UI) Update(msg tea.Msg) (tea.Model, tea.Cmd) { } case tea.MouseMotionMsg: + // Pass mouse events to dialogs first if any are open. + if m.dialog.HasDialogs() { + m.dialog.Update(msg) + return m, tea.Batch(cmds...) + } + switch m.state { case uiChat: if msg.Y <= 0 { @@ -541,6 +552,11 @@ func (m *UI) Update(msg tea.Msg) (tea.Model, tea.Cmd) { } case tea.MouseReleaseMsg: + // Pass mouse events to dialogs first if any are open. + if m.dialog.HasDialogs() { + m.dialog.Update(msg) + return m, tea.Batch(cmds...) + } const doubleClickThreshold = 500 * time.Millisecond switch m.state {