-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modal may run openModal after component is already disconnected leaving state in the DOM #6594
Comments
Trying to get a fix for this but I'm seeing a bug with stencil. ionic-team/stencil#4070 If a component is removed right after its added it doesn't seem to call the This fix can benefit from use of an AbortController to abort opening the modal after requestAnimationFrame if the controller was aborted in disconnectedCallback. But since the disconnectedCallback bug exists we can't really clean stuff up on disconnectedCallback. I was thinking we should move the initial open logic into connectedCallback as well because it seems like openModal should be called if the component is moved in the DOM too, not just on first load. |
@driskull Thanks for digging. That bug is quite unfortunate. I'm afraid we can't do anything regarding that issue until it's fixed and we bump Stencil. Regarding the issue at hand, I did notice that the repro case behaves differently depending on the output target used:
@jkieboom Could you check if this is also happening in your testing environment? If not, would it be possible to get an updated repro case to better reflect the issue? LMK if we can help here.
IIRC, after initial load, |
We don't actually override |
Gotcha. I'll reach out to get a closer look at the test failures. Hope we can find a repro case. Otherwise, we'll have to put this in the back burner until the Stencil lifecycle issue is fixed. |
[belated] @jkieboom provided an updated (internal) repro case for this. He also confirmed it's not critical, so we'll be moving this to a later milestone (after the Stencil v4 update as the |
Tested locally, and this is still an issue w/ |
Narrowed down the issue to this line. We store the initial overflow style to restore it when modal is closed, which is only correct for the first modal that opens. Subsequent ones will store the style that the modal applies, hence why |
Makes total sense! nice find |
Sounds like a registry of modals could handle this. |
…n multiple modals are closed/removed (#8390) **Related Issue:** #6594 ## Summary We store the initial overflow style to restore it when modal is closed, which is only correct for the first modal that opens. Subsequent ones will store the style that the modal applies, so the incorrect overflow value is applied after all modals are removed in a different order. This updates modal to store the initial overflow style only for the first modal that is open. This will ensure the correct initial overflow style is restored when all modals have been closed.
Installed and assigned for verification. |
🍡 Verified locally on |
Actual Behavior
Because calling
openModal
isasync
, it is possible for the component to become disconnected beforeopenModal
is actually run. In this caseopenModal
will leave side effects in the DOM that are not cleaned up. In particular it leaves theoverflow-hidden
CSS class on thehtml
node.Expected Behavior
The modal component does not produce any side effects once disconnected.
Reproduction Sample
https://codepen.io/jkieboom/pen/NWLYgRe
Reproduction Steps
Reproduction Version
@latest
Relevant Info
No response
Regression?
No response
Priority impact
p3 - not time sensitive
Impact
This was uncovered in our CI because it left state that affected other tests.
Esri team
ArcGIS Maps SDK for JavaScript
The text was updated successfully, but these errors were encountered: