Skip to content

fix: Enter key stops working after viewing a notification#764

Merged
dlvhdr merged 1 commit intodlvhdr:mainfrom
sideshowbarker:fix-notification-enter-key
Feb 7, 2026
Merged

fix: Enter key stops working after viewing a notification#764
dlvhdr merged 1 commit intodlvhdr:mainfrom
sideshowbarker:fix-notification-enter-key

Conversation

@sideshowbarker
Copy link
Contributor

Summary

Fixes a bug where pressing Enter on a notification would stop working after viewing any notification. The first Enter would work, but subsequent presses (on the same or different notifications) would have no effect.

Problem

The NotificationsView key handler used a switch statement where the PR/Issue subject checks came before the Enter key check:

switch {
case m.notificationView.GetSubjectPR() != nil:
    // ALL keys routed here when PR subject is set
    // Enter gets absorbed, never reaches loadNotificationContent()
    
case key.Matches(msg, keys.NotificationKeys.View):  // Enter
    // Never reached if GetSubjectPR() != nil
}

Once a notification was viewed and the subject set, Enter would be absorbed by the PR/Issue handler instead of triggering loadNotificationContent().

Solution

Move the Enter key handling before the subject checks:

switch {
case key.Matches(msg, keys.NotificationKeys.View):  // Enter
    cmds = append(cmds, m.loadNotificationContent())

case m.notificationView.GetSubjectPR() != nil:
    // PR-specific keys handled here
}

Also clears the cached subject in syncSidebar() when navigating to a different notification, ensuring key dispatch routes correctly.

When a notification is marked as done and removed from the list, the
cached subject (subjectPR/subjectIssue) wasn't being cleared. This
caused key dispatch to route keys to the wrong handler since it checks
`GetSubjectPR() != nil` to determine which handler to use.

Fix by clearing the cached subject in syncSidebar() when the current
notification doesn't match the cached subject ID.
@dlvhdr dlvhdr merged commit 6f20475 into dlvhdr:main Feb 7, 2026
3 checks passed
@sideshowbarker sideshowbarker deleted the fix-notification-enter-key branch February 9, 2026 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants