Skip to content

[notification] Interacting with a notification closes top-most overlay component #9850

@sissbruecker

Description

@sissbruecker

Description

Since refactoring overlays to be in the shadow root of their owning components, events such as vaadin-dialog-close do not propagate to the document anymore. As such this logic for preventing overlays from closing when interacting with notifications (clicking, pressing Escape) does not work anymore:

/** @private */
_onVaadinOverlayClose(event) {
// Notifications are a separate overlay mechanism from vaadin-overlay, and
// interacting with them should not close modal overlays
const sourceEvent = event.detail.sourceEvent;
const isFromNotification = sourceEvent && sourceEvent.composedPath().indexOf(this) >= 0;
if (isFromNotification) {
event.preventDefault();
}
}

Expected outcome

Interacting with a notification should not affect other overlays.

Apart from fixing the logic we should also add a proper integration test using a notification and dialog, as the existing test was not sufficient in detecting this regression.

Minimal reproducible example

<vaadin-dialog opened></vaadin-dialog>
<vaadin-notification opened></vaadin-notification>

Steps to reproduce

  1. Click the notification
  2. Observe that the dialog closes

Environment

Vaadin version(s): v25 only

Browsers

Issue is not browser related

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingregressionSometimes we make things breakv25To be done in V25vaadin-notification

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions