Skip to content

Opening modal immediately after hydration yields inconsistent transitions #5067

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

Closed
nwhittaker opened this issue Aug 2, 2022 · 6 comments
Closed
Assignees
Labels
4 - verified Issues that have been tested, confirmed as mitigated, and are ready to close. ArcGIS Field Apps Issues logged by ArcGIS Field Apps team members. bug Bug reports for broken functionality. Issues should include a reproduction of the bug. has workaround Issues have a workaround available in the meantime.

Comments

@nwhittaker
Copy link
Contributor

Actual Behavior

Once a calcite-modal element becomes hydrated, setting the open attribute causes the modal's backdrop to appear abruptly while the dialog area transitions in smoothly.

ezgif com-gif-maker

Expected Behavior

The modal's backdrop also transitions in smoothly.

ezgif com-gif-maker (1)

Reproduction Sample

https://codepen.io/nwhittaker-esri/pen/qBoxdgg

Reproduction Steps

  1. Visit code sample and notice how the modal's backdrop appears immediately.
  2. Close the modal.
  3. Click the Open modal button to re-open; notice how modal's backdrop transitions smoothly now.

It may be helpful to use Chrome's Animations tab to slow down the transitions.

Reproduction Version

beta.86

Relevant Info

A workaround is to wait about .5s after hydration before setting open to produces the expected result.

In Ember it's typical to render the <calcite-modal> element at the time it needs to open (ideally w/out a delay). open is set after hydration because setting it initially currently has a couple drawbacks:

  1. Both backdrop and dialog appear abruptly (possibly expected?).
  2. Focus not trapped (et al.) by modal if initially active #4764

Regression?

No response

@nwhittaker nwhittaker added bug Bug reports for broken functionality. Issues should include a reproduction of the bug. 0 - new New issues that need assignment. needs triage Planning workflow - pending design/dev review. labels Aug 2, 2022
@jcfranco jcfranco added has workaround Issues have a workaround available in the meantime. and removed needs triage Planning workflow - pending design/dev review. labels Aug 23, 2022
@jcfranco
Copy link
Member

Looks like the initial transition is skipped entirely because the host is initially rendered as end state (host initially rendered w/ open), so there's no initial set of props to animate/transition from.

@nwhittaker
Copy link
Contributor Author

There may be some confusion on my part around when an element is considered rendered relative to when it is considered hydrated.

I understand if there's no transition when open is enabled before hydration. But enabling it any time after hydration feels like it should be safe to assume the styles for the unopened state were applied.

@geospatialem
Copy link
Member

Reallocating this issue to the February priorities milestone.

@benelan benelan added ArcGIS Field Apps Issues logged by ArcGIS Field Apps team members. and removed ArcGIS Field Apps labels Jan 30, 2023
@jcfranco
Copy link
Member

jcfranco commented Mar 4, 2023

There may be some confusion on my part around when an element is considered rendered relative to when it is considered hydrated.
I understand if there's no transition when open is enabled before hydration. But enabling it any time after hydration feels like it should be safe to assume the styles for the unopened state were applied.

Finally getting back to this. 😅 When a component is hydrated, it means it has finished lazy-loading its implementation and has been initially rendered.

Setting open after hydration or first render, should pretty much display the transition how you would expect. The real issue here was due to the initial render already having open and the transition not having a 'closed' state to transition from. We had fixed this previously for the modal itself, but not its container (transitions the underlay).

#6564 should help keep all of modal's transitions in sync.

@jcfranco jcfranco self-assigned this Mar 4, 2023
@jcfranco jcfranco added 2 - in development Issues that are actively being worked on. and removed 0 - new New issues that need assignment. labels Mar 4, 2023
jcfranco added a commit that referenced this issue Mar 6, 2023
**Related Issue:** #5067 

## Summary

Moves an internal open state class to the topmost container so all
transitions are in sync.
@jcfranco jcfranco added 3 - installed Issues that have been merged to the "dev" branch and/or are ready for QA/QC. and removed 2 - in development Issues that are actively being worked on. labels Mar 6, 2023
@github-actions github-actions bot assigned geospatialem and unassigned jcfranco Mar 6, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2023

Installed and assigned for verification.

@geospatialem geospatialem added 4 - verified Issues that have been tested, confirmed as mitigated, and are ready to close. and removed 3 - installed Issues that have been merged to the "dev" branch and/or are ready for QA/QC. labels Mar 15, 2023
@geospatialem
Copy link
Member

Verified on master

verify-modal-transition-initialization

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4 - verified Issues that have been tested, confirmed as mitigated, and are ready to close. ArcGIS Field Apps Issues logged by ArcGIS Field Apps team members. bug Bug reports for broken functionality. Issues should include a reproduction of the bug. has workaround Issues have a workaround available in the meantime.
Projects
None yet
Development

No branches or pull requests

5 participants