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

fix(modal, popover): quickly opening modal/popover no longer presents duplicates #24697

Merged
merged 1 commit into from
Feb 2, 2022

Conversation

liamdebeasi
Copy link
Contributor

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • Build (npm run build) was run locally and any changes were pushed
  • Lint (npm run lint) has passed locally and any fixes were made for failures

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Given a button that calls modalController.create and modalController.present, double clicking it currently results in 2 modals being presented. This is technically the correct behavior, but it is undesirable to some developers.

In Ionic 5, the modals/popovers would receive pointer-events the moment the presenting animation began, so this double modal behavior never happened. On the second click, the modal would receive the click causing the 2nd modal to not get presented.

In Ionic 6, modals/popovers did not receive pointer events by default causing the behavior to reproduce more easily. The reason why it changed was due to a workaround to get inline modals to behave properly. However,

What is the new behavior?

  • Modals/popovers receive pointer events by default. When a modal/popover is initially added to the DOM, it gets display: none so in that case pointer events are not received. This behavior only applies when the modal/popover is set to be presented.

Does this introduce a breaking change?

  • Yes
  • No

Other information

Note: I wasn't able to create an automated test that wasn't flaky. If you have ideas for how I can better automate a test for this, let me know!

@liamdebeasi liamdebeasi requested a review from a team as a code owner February 2, 2022 15:43
@github-actions github-actions bot added the package: core @ionic/core package label Feb 2, 2022
Copy link
Contributor

@sean-perkins sean-perkins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good 👍 cannot think of a way to simulate that wouldn't be flaky, besides possibly opening a modal/popover, manually changing it's appearance to be not visible and then simulating the pointer events into the state that would align with double clicking the button that opens a modal.

@liamdebeasi liamdebeasi merged commit 928c5fb into main Feb 2, 2022
@liamdebeasi liamdebeasi deleted the FW-679 branch February 2, 2022 18:38
@averyjohnston
Copy link
Contributor

@agencia-estado Please open a new issue with a repo we can use to reproduce the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: core @ionic/core package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants