You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7a1c46f
Browse filesBrowse the repository at this point in the historyBrowse files
fix: do not delay auto-adding Popover by beforeClientResponse (#7563)
* fix: reattach auto-added Popover
If a popover tries to auto-add itself when another modal element is
opened, it may end up being added as a child of said element. That can
be problematic in case the target element is not part of the parent
modal element and, when the modal is closed, the popover instance is
removed with its parent and interacting with the target element won't
work as expected.
This fix adds a detach listener to popover and tries to reattach it in
case of:
- the popover instance has been auto-added
- the target element is present
- the target element is still attached to the page
Fixes#7505
* test: add a test scenario for the use-case being fixed
* refactor: auto-add popover to target parent
* test: wait for dialog element to be removed
---------
Co-authored-by: Sascha Ißbrücker <sissbruecker@vaadin.com>
Copy file name to clipboardExpand all lines: vaadin-popover-flow-parent/vaadin-popover-flow-integration-tests/src/main/java/com/vaadin/flow/component/popover/tests/PopoverView.java
Copy file name to clipboardExpand all lines: vaadin-popover-flow-parent/vaadin-popover-flow-integration-tests/src/test/java/com/vaadin/flow/component/popover/tests/PopoverIT.java
+16Lines changed: 16 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -135,6 +135,22 @@ public void disableCloseOnEsc_pressEsc_popoverDoesNotClose() {
Copy file name to clipboardExpand all lines: vaadin-popover-flow-parent/vaadin-popover-flow/src/main/java/com/vaadin/flow/component/popover/Popover.java
+20-19Lines changed: 20 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -696,10 +696,7 @@ public void setTarget(Component target) {
696
696
targetDetachRegistration.remove();
697
697
}
698
698
699
-
if (autoAddedToTheUi) {
700
-
getElement().removeFromParent();
701
-
autoAddedToTheUi = false;
702
-
}
699
+
removeFromUiIfAutoAdded();
703
700
704
701
this.target = target;
705
702
@@ -710,27 +707,31 @@ public void setTarget(Component target) {
710
707
711
708
// Target's JavaScript needs to be executed on each attach,
0 commit comments