Skip to content

Commit 4f97ba1

Browse files
authored
fix: skip auto-adding on navigation only for LoginOverlay (#7340)
* fix: always auto-add overlays * improve javadoc * scope skipping auto-adding on navigation only to LoginOverlay
1 parent 48c2a85 commit 4f97ba1

File tree

24 files changed

+140
-682
lines changed

24 files changed

+140
-682
lines changed

vaadin-confirm-dialog-flow-parent/vaadin-confirm-dialog-flow-integration-tests/src/main/java/com/vaadin/flow/component/confirmdialog/tests/ConfirmDialogOpenedAfterForwardingSourcePage.java

-31
This file was deleted.

vaadin-confirm-dialog-flow-parent/vaadin-confirm-dialog-flow-integration-tests/src/main/java/com/vaadin/flow/component/confirmdialog/tests/ConfirmDialogOpenedAfterForwardingTargetPage.java

-30
This file was deleted.

vaadin-confirm-dialog-flow-parent/vaadin-confirm-dialog-flow-integration-tests/src/main/java/com/vaadin/flow/component/confirmdialog/tests/ConfirmDialogOpenedBeforeForwardingSourcePage.java

-36
This file was deleted.

vaadin-confirm-dialog-flow-parent/vaadin-confirm-dialog-flow-integration-tests/src/main/java/com/vaadin/flow/component/confirmdialog/tests/ConfirmDialogOpenedBeforeForwardingTargetPage.java

-28
This file was deleted.

vaadin-confirm-dialog-flow-parent/vaadin-confirm-dialog-flow-integration-tests/src/test/java/com/vaadin/flow/component/confirmdialog/tests/ConfirmDialogOpenedAfterForwardingIT.java

-40
This file was deleted.

vaadin-confirm-dialog-flow-parent/vaadin-confirm-dialog-flow-integration-tests/src/test/java/com/vaadin/flow/component/confirmdialog/tests/ConfirmDialogOpenedBeforeForwardingIT.java

-40
This file was deleted.

vaadin-confirm-dialog-flow-parent/vaadin-confirm-dialog-flow/src/main/java/com/vaadin/flow/component/confirmdialog/ConfirmDialog.java

+19-7
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import com.vaadin.flow.component.HasStyle;
3030
import com.vaadin.flow.component.Shortcuts;
3131
import com.vaadin.flow.component.Tag;
32+
import com.vaadin.flow.component.UI;
3233
import com.vaadin.flow.component.dependency.JsModule;
3334
import com.vaadin.flow.component.dependency.NpmPackage;
3435
import com.vaadin.flow.component.shared.SlotUtils;
@@ -621,9 +622,14 @@ public void setHeader(Element element) {
621622
/**
622623
* Opens the dialog.
623624
* <p>
624-
* Note: You don't need to add the dialog component before opening it, cause
625-
* opening a dialog will automatically add it to the {@code <body>} if it's
626-
* not yet attached anywhere.
625+
* If a dialog was not added manually to a parent component, it will be
626+
* automatically added to the {@link UI} when opened, and automatically
627+
* removed from the UI when closed. Note that the dialog is then scoped to
628+
* the UI, and not the current view. As such, when navigating away from a
629+
* view, the dialog will still be opened or stay open. In order to close the
630+
* dialog when navigating away from a view, it should either be explicitly
631+
* added as a child to the view, or it should be explicitly closed when
632+
* leaving the view.
627633
*/
628634
public void open() {
629635
setOpened(true);
@@ -632,8 +638,8 @@ public void open() {
632638
/**
633639
* Closes the dialog.
634640
* <p>
635-
* Note: This method also removes the dialog component from the DOM after
636-
* closing it, unless you have added the component manually.
641+
* This automatically removes the dialog from the {@link UI}, unless it was
642+
* manually added to a parent component.
637643
*/
638644
public void close() {
639645
setOpened(false);
@@ -646,8 +652,14 @@ public boolean isOpened() {
646652
/**
647653
* Opens or closes the dialog.
648654
* <p>
649-
* Note: Confirm-dialog will be attached or detached from the DOM
650-
* automatically, if it was not added manually.
655+
* If a dialog was not added manually to a parent component, it will be
656+
* automatically added to the {@link UI} when opened, and automatically
657+
* removed from the UI when closed. Note that the dialog is then scoped to
658+
* the UI, and not the current view. As such, when navigating away from a
659+
* view, the dialog will still be opened or stay open. In order to close the
660+
* dialog when navigating away from a view, it should either be explicitly
661+
* added as a child to the view, or it should be explicitly closed when
662+
* leaving the view.
651663
*
652664
* @param opened
653665
* {@code true} to open the confirm-dialog, {@code false} to

vaadin-dialog-flow-parent/vaadin-dialog-flow-integration-tests/src/main/java/com/vaadin/flow/component/dialog/tests/DialogOpenedAfterForwardingSourcePage.java

-31
This file was deleted.

vaadin-dialog-flow-parent/vaadin-dialog-flow-integration-tests/src/main/java/com/vaadin/flow/component/dialog/tests/DialogOpenedAfterForwardingTargetPage.java

-30
This file was deleted.

vaadin-dialog-flow-parent/vaadin-dialog-flow-integration-tests/src/main/java/com/vaadin/flow/component/dialog/tests/DialogOpenedBeforeForwardingSourcePage.java

-36
This file was deleted.

vaadin-dialog-flow-parent/vaadin-dialog-flow-integration-tests/src/main/java/com/vaadin/flow/component/dialog/tests/DialogOpenedBeforeForwardingTargetPage.java

-28
This file was deleted.

0 commit comments

Comments
 (0)