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): keyboard listener removed on dismiss #26856

Merged
merged 2 commits into from Feb 27, 2023
Merged

fix(modal): keyboard listener removed on dismiss #26856

merged 2 commits into from Feb 27, 2023

Conversation

liamdebeasi
Copy link
Contributor

@liamdebeasi liamdebeasi commented Feb 24, 2023

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)
    • Some docs updates need to be made in the ionic-docs repo, in a separate PR. See the contributing guide for details.
  • 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?

Part of #26833

The keyboard listener is added after the transition completes. This means that if you present and dismiss a modal quickly, the dismiss method will run before the keyboard listener is added. This is because the dismiss method only waits for the transition to finish before proceeding. As a result, the keyboard listener is never removed.

What is the new behavior?

  • Updated the present method to create the keyboard listener before the transition runs, that way it can always be removed in dismiss. Note that the callback already checks to see if the gesture is configured so we can safely add this listener before the gestures are fully configured.

Does this introduce a breaking change?

  • Yes
  • No

Other information

@stackblitz
Copy link

stackblitz bot commented Feb 24, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@liamdebeasi liamdebeasi changed the title Modal key @liamdebeasi fix(modal): keyboard listener removed on dismiss Feb 24, 2023
@github-actions github-actions bot added the package: core @ionic/core package label Feb 24, 2023
@liamdebeasi liamdebeasi changed the title @liamdebeasi fix(modal): keyboard listener removed on dismiss fix(modal): keyboard listener removed on dismiss Feb 24, 2023
@@ -333,7 +333,7 @@ export class Modal implements ComponentInterface, OverlayInterface {
if (this.gesture) {
this.gesture.enable(enable);
} else if (enable) {
await this.initSwipeToClose();
this.initSwipeToClose();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This method is not async, so it does not need await

@liamdebeasi liamdebeasi merged commit b4bcba3 into main Feb 27, 2023
@liamdebeasi liamdebeasi deleted the modal-key branch February 27, 2023 16:52
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.

None yet

2 participants