Skip to content

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

Merged
liamdebeasi merged 2 commits into
mainfrom
modal-key
Feb 27, 2023
Merged

fix(modal): keyboard listener removed on dismiss#26856
liamdebeasi merged 2 commits into
mainfrom
modal-key

Conversation

@liamdebeasi

@liamdebeasi liamdebeasi commented Feb 24, 2023

Copy link
Copy Markdown
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)
    • 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

@bolt-new-by-stackblitz

Copy link
Copy Markdown

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
this.gesture.enable(enable);
} else if (enable) {
await this.initSwipeToClose();
this.initSwipeToClose();

Copy link
Copy Markdown
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 marked this pull request as ready for review February 24, 2023 18:28
@liamdebeasi
liamdebeasi requested a review from a team as a code owner February 24, 2023 18:28
@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.

2 participants