Open mil3stone opened 2 years ago
This is due to a feature in Flow called server-side modality. The basic idea is that events from components that have not been added as children to a modal dialog will be ignored. This scenario is definitely problematic though.
As a workaround I see two options:
open
method of the dialog like so:
@Override
public void open() {
super.open();
UI.getCurrent().beforeClientResponse(this, executionContext -> {
UI.getCurrent().setChildComponentModal(this, false);
});
}
@mshabarov , do you think this could be tackled from Flow server-side modality logic?
This example uses client-side modality, which is enabled by default for Dialog
.
The same issue appears when the server-side modality is enabled by UI.addModal(Component)
.
For both options this code should unblock the notification for user interactions:
Notification notification = Notification.show(...);
ElementUtil.setIgnoreParentInert(notification.getElement(), true);
But this is not intuitive at all and a bad DX.
I like the idea to make Notification
call ElementUtil.setIgnoreParentInert
by default, so to make it reachable by default when being opened from dialogs. I'm quite sure that the opposite behaviour (like shown in the video) is NOT desirable for any users: who wants to have an unreachable UI pop-up component when being opened from other modal component...
Apart from Notification
, I can't come up with any other Vaadin component what may need this, unless it's a custom overlay component not extending Dialog
.
We could consider disabling server-side modality for notifications.
Description
When opening a modal
Dialog
after aNotification
is shown, the controls inside theNotification
aren't clickable anymore. They aren't disabled, it is more like their respective ClickListeners were disabled. You first have to close theDialog
(which is behind theNotification
) to make theNotification
's button work again.Expected outcome
I would expect to be able to click the button inside the
Notification
- because it is shown on top and the buttons aren't disabled.Minimal reproducible example
Main class MyView
class MyDialog
class MySecondDialog
class MyNotification
Steps to reproduce
As shown in the GIF. Please use the provided minimal reproducible example: 1) click the button "show modal" -> a modal
Dialog
opens 2) click the button "open notification" -> the firstDialog
disappears, aNotification
is opened and a newDialog
is shown 3) try to close the notification by clicking the corresponding button -> can't be closed unless theDialog
is opened.Environment
Vaadin version(s): 23.1.6 OS: Win10
Browsers
Issue is not browser related