Repository navigation
fix(popover): dismiss inline popover when its parent is removed - #31868
Conversation
|
@Ultranmus is attempting to deploy a commit to the Ionic Team on Vercel. A member of the Team first needs to authorize it. |
thetaPC
left a comment
There was a problem hiding this comment.
Thanks for the fix!
The approach matches what ion-modal does, and checking isConnected alone is an improvement: unlike the modal, the popover stays open when its parent is only moved. A couple of changes below, the first one for nested popovers.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Thanks for the review! Made all three changes: passing false so a submenu doesn't close its parent, your moved-popover test plus a nested one (removes the submenu's container and checks the parent stays open, and fails without the false), and the comments on the observer and the guard. |
|
Congrats on your first contribution to Ionic Framework, and thanks for the quick turnaround on the review! The fix will be in the upcoming release. |
Issue number: resolves #31858
What is the current behavior?
An inline
ion-popoveris moved to the app root while it's presented. If the element it was declared in gets removed (an@ifturning false, for example), the popover stays open over the page, with its backdrop andbackdrop-no-scrollonbody, until the user taps the backdrop.What is the new behavior?
parent-removedrole when that parent is removed. This is the same thingion-modaldoes since fix(modal): dismiss modal when parent element is removed from DOM #30544.present()and again if the presented popover is moved, and is cleaned up on dismiss and disconnect.bodyorion-appare skipped, as in modal.Does this introduce a breaking change?
Other information
Added an e2e test in
popover/test/inlinethat opens a popover, removes its container and checks it's dismissed with the right role and thatbodyno longer hasbackdrop-no-scroll. It fails without the change. The popover, modal, select and datetime-button e2e suites pass locally on Mobile Chrome, along with the popover spec tests and lint.