vaadin / web-components

A set of high-quality standards based web components for enterprise web applications. Part of Vaadin 20+
https://vaadin.com/docs/latest/components
457 stars 83 forks source link

[notification] Should not close other overlays, when interacting with notification content #844

Open manolo opened 6 years ago

manolo commented 6 years ago

If there is a notification card with some intractable content like a close button, actions shouldn't affect already opened overlays like dialogs.

Notification might have other content apart from buttons or links, we need to consider also non-click events

platosha commented 6 years ago

I cannot find any good solution here for <vaadin-notification> alone, we might want to fix that in <vaadin-overlay> too.

The thing is that the outside click listener in the overlay is too powerful. Currently <vaadin-overlay> uses a capture mode listener on the body to catch all the click events before they propagate down the hierarchy to their corresponding element on the page.

The notification could have another capture mode listener to beat the overlay’s one, but this feels hacky. It is weird that the notification has to beat the overlay’s listener in the first place.

Looks like the capture mode body listener in the overlay is an overkill, especially considering that the overlay also sets pointer-events: none; to the body. I would suggest refactoring the overlay to not use capture mode listeners, then it would be a lot more straightforward to fix the issue in the notification (event.stopPropagation() would do, for example).