-
Notifications
You must be signed in to change notification settings - Fork 75
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 beforeClose
behaves differently when removing open
attribute
#6407
Comments
Research needed to determine next steps, if related to #6279, or if additional mitigation is needed. |
Hey @driskull, for research consideration in this milestone for time estimate and priority to be added |
Maybe we need to introduce a public close method that would handle this and return a promise. cc @jcfranco
I think its weird that the watcher is calling beforeClose. The watcher should just honor what was done and remove the necessary classes. |
…6407 introduces a close public method which will call beforeClose
Changed the estimate since this requires a new pattern discussion. |
…oreClose calls (#7470) **Related Issue:** #6407 #6379 ## Summary - Add internal property `opened` to maintain open state when beforeBack is rejected and to handle initial animation. - Refactor `beforeClose` default value. - Rename internal close method name to be consistent with internal open method name - Prevent `beforeClose` from being called twice by adding an internal flag to ignore watch changes when necessary. - Tests
Installed and assigned for verification. |
Verified in |
Actual Behavior
Closing a modal via its built-in UI (close button, escape key, or outside click) can be interrupted by having its
beforeClose()
callback return a rejected promise.However closing a modal by removing its
open
attribute can not be interrupted in the same way. The modal also enters into an inconsistent state where itsopen
andisOpen
properties are out-of-sync and anoverflow-hidden
class remains on the document element.Expected Behavior
Closing the modal by removing the
open
attribute and having itsbeforeClose()
callback return a rejected promise does no leave the modal in an inconsistent state.Ideally the
open
attribute is restored, but if not, maybe generate a warning for this scenario and then provide an API method that can be used to programmatically close a modal in a way that is interruptible by thebeforeClose()
callback.Reproduction Sample
https://codepen.io/nwhittaker-esri/pen/JjBeJVr
Reproduction Steps
beforeClose
returns a rejected promise.<html>
element retains the modal'soverflow-hidden
CSS class and the.modal
element within the modal's shadow-dom retains themodal--open
class.Reproduction Version
1.0.3
Relevant Info
No response
Regression?
No response
Impact
Having
beforeClose()
reject is useful for flows where the app needs to confirm the closure of a modal.One workaround is for the consumer to run
beforeClose()
themselves before actually removing theopen
attribute. However this leads to some more complicated code to preventbeforeClose()
from running more than once per close attempt.Esri team
ArcGIS Field Apps
The text was updated successfully, but these errors were encountered: