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(android): account for chrome 108 resize #26244

Merged
merged 10 commits into from Nov 8, 2022
Merged

fix(android): account for chrome 108 resize #26244

merged 10 commits into from Nov 8, 2022

Conversation

liamdebeasi
Copy link
Member

@liamdebeasi liamdebeasi commented Nov 8, 2022

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?

Chrome 108 introduces a change to how the Layout Viewport is resized when the on-screen keyboard (OSK) is displayed. In short, the Layout Viewport no longer resizes aligning Android Chrome's behavior with iOS Safari's behavior. As a result, scroll assist is needed for Android devices only when running in a mobile web browser. There are no changes to Android webviews. Full details on the change can be found here: https://developer.chrome.com/blog/viewport-resize-behavior/

What is the new behavior?

  • Activated input shims on Android devices running in a mobile web browser.
  • Added logic to ensure that the high caret and input blurring utils only activate on iOS (not needed for Android).
  • Added logic to scroll assist to correctly prevent the native browser resize in Chrome (the disabled input).

Note: It is not currently possible to read the browser's resize behavior. There are some workarounds we can implement such as checking to see that the layout viewport does not change when the keyboard is open, but they are somewhat complex to implement in Ionic. I created video comparisons with Chrome 108 and pre-Chrome 108 behaviors.

Chrome 107

main branch
chrome107-no-sa.mp4
chrome107-sa.mp4

Chrome 108 Beta

main branch
chrome108-no-sa.mp4
chrome108-sa.mp4

One unfortunate downside is that apps running in mobile Chrome may encounter #18532. (As noted before, this has no impact on Android webview apps i.e. Capacitor/Cordova). However, this bug in fixed in Ionic 7. If this issue is a blocker for developers before Ionic 7 is released, they can also opt Chrome into using the legacy resize behavior until Ionic 7 by adding interactive-widget=overlays-content to their viewport meta tag.

Full Example:

<meta name="viewport" content="viewport-fit=cover, width=device-width, initial-scale=1.0, interactive-widget=overlays-content" />

Does this introduce a breaking change?

  • Yes
  • No

Other information

@github-actions github-actions bot added the package: core @ionic/core package label Nov 8, 2022
@liamdebeasi liamdebeasi marked this pull request as ready for review November 8, 2022 17:56
@liamdebeasi liamdebeasi requested a review from a team as a code owner November 8, 2022 17:56
@liamdebeasi liamdebeasi merged commit 1a0b9ed into main Nov 8, 2022
@liamdebeasi liamdebeasi deleted the chrome-108 branch November 8, 2022 20:31
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

3 participants