Skip to content

Conversation

vhenckel
Copy link
Contributor

Summary

This PR fixes the issue where clicking the "Dismiss" (X) button on individual notifications would close the entire notification panel instead of removing only that specific notification.

Problem

  • Clicking the "X" button on individual notifications closed the entire notification panel
  • The notification remained in the list after the panel was closed
  • Users could not dismiss individual notifications while keeping the panel open

Solution

Changes Made

1. Fixed dismiss button event handling:

  • Removed c-overlay__close-button CSS class that was causing conflict with overlay close behavior
  • Added @click.stop and comprehensive event prevention to stop propagation
  • Introduced dedicated dismissNotification() method with proper event handling

2. Improved notification panel behavior:

  • Panel now stays open when individual notifications are dismissed
  • Users can manage multiple notifications without the panel closing unexpectedly
  • Panel only closes when manually dismissed by user (via close button or outside click)

3. Enhanced component communication:

  • Added proper event emission chain between NotificationMessage → NotificationsList → NotificationIndicator
  • Ensures reactive updates when notifications are removed

Files Modified

  • src/plugins/notificationIndicator/components/NotificationMessage.vue

    • Fixed dismiss button CSS classes and event handling
    • Added dismissNotification() method with proper event prevention
    • Added notification-dismissed event emission
  • src/plugins/notificationIndicator/components/NotificationsList.vue

    • Added handler for individual notification dismissal
    • Improved event propagation to parent component

Testing

Manual Testing Steps

  1. Create multiple persistent notifications:
    openmct.notifications.error('Error 1');
    openmct.notifications.error('Error 2');
    openmct.notifications.alert('Alert 1');
  2. Open notification panel
  3. Click "X" on individual notifications
  4. Verify:
    • ✅ Only the clicked notification is removed
    • ✅ Panel remains open
    • ✅ Other notifications remain visible
    • ✅ Panel can be closed manually

Expected Behavior

  • Before: Clicking "X" → Panel closes, notification remains
  • After: Clicking "X" → Notification removed, panel stays open

Backwards Compatibility

  • No breaking changes
  • All existing notification functionality preserved
  • Auto-dismiss behavior for info notifications unchanged
  • "Clear All Notifications" button continues to work as expected

Fixes

Closes #8103

- Restore c-overlay__close-button class to maintain proper CSS positioning
- Keep event prevention logic to fix dismiss functionality
- Button now appears in correct position (top-right) while maintaining individual dismiss behavior
@vhenckel
Copy link
Contributor Author

@charlesh88

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.

Cannot dismiss individual notifications — panel closes, notification remains

1 participant