Skip to content
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

Closing a modal using built-in UI calls beforeClose twice #6379

Closed
nwhittaker opened this issue Jan 30, 2023 · 3 comments
Closed

Closing a modal using built-in UI calls beforeClose twice #6379

nwhittaker opened this issue Jan 30, 2023 · 3 comments
Assignees
Labels
4 - verified Issues that have been released and confirmed resolved. 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. estimate - 8 Requires input from team, consider smaller steps. p - medium Issue is non core or affecting less that 60% of people using the library

Comments

@nwhittaker
Copy link
Contributor

Actual Behavior

Closing a modal via its built-in close button, the esc key, or clicking outside the modal invokes the modal's beforeClose callback twice.

Expected Behavior

Closing a modal via its built-in close button, the esc key, or clicking outside the modal invokes the modal's beforeClose callback once.

Reproduction Sample

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

Reproduction Steps

  1. Visit the pen and open the console.
  2. Close the modal via either its close button, pressing the esc key, or clicking outside the modal.
  3. Notice beforeClose is logged twice.

Reproduction Version

1.0.3

Relevant Info

No response

Regression?

No response

Impact

The Field Maps web app has some modal's that need to confirm their closure in cases where data loss could occur. We'd like to use the beforeClose callback to do this, but having it called twice in some cases could introduce unintended side-effects.

Esri team

ArcGIS Field Apps

@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 Jan 30, 2023
@github-actions github-actions bot added the ArcGIS Field Apps Issues logged by ArcGIS Field Apps team members. label Jan 30, 2023
@brittneytewks brittneytewks added p - medium Issue is non core or affecting less that 60% of people using the library estimate - 8 Requires input from team, consider smaller steps. labels Apr 11, 2023
@brittneytewks brittneytewks removed the needs triage Planning workflow - pending design/dev review. label Apr 11, 2023
@driskull
Copy link
Member

I think this is because the watcher for open is calling close as well as the click handler.

driskull added a commit that referenced this issue Aug 23, 2023
…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
@driskull driskull added 3 - installed Issues that have been merged to master branch and are ready for final confirmation. and removed 2 - in development Issues that are actively being worked on. labels Aug 23, 2023
@github-actions github-actions bot assigned geospatialem and unassigned driskull Aug 23, 2023
@github-actions
Copy link
Contributor

Installed and assigned for verification.

@geospatialem geospatialem added 4 - verified Issues that have been released and confirmed resolved. and removed 3 - installed Issues that have been merged to master branch and are ready for final confirmation. labels Aug 27, 2023
@geospatialem
Copy link
Member

Verified with 1.7.0-next.9.

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 released and confirmed resolved. 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. estimate - 8 Requires input from team, consider smaller steps. p - medium Issue is non core or affecting less that 60% of people using the library
Projects
None yet
Development

No branches or pull requests

6 participants