Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 [Attachment Forms] Maintain the mobile UI layout when the soft keyb…
…oard opens or closes (ampproject#35908) * Add window observer that maintains the grid layer height when the soft keyboard opens/closes * Add missing commas * Temporarily OK the usage of getLayoutBox() * Move logic to amp-story instead of amp-story-grid-layer * Set the story's height to the max seen viewport height instead of the max seen story height * Remove unnecesary commas * Revert amp-story-grid-layer.js * Prevent the soft keyboard from incorrectly triggering desktop UI state changes * Adjust draggable drawer height on viewport height change and simplify amp-story TOGGLE_UI logic * Run onViewportResize() within a measureElement * Move softKeyboardIsProbablyOpen logic to getUIType_() * Remove console logs added for testing * Add textarea to the list of element tags that can cause soft keyboard to open, and reset fixed inline height once the layout shifts away from mobile * Add platformIsAndroid as an additional factor when determining whether the soft keyboard is open * Remove empty else block * Lint fix * Remove unnecessary if guard around the TOGGLE_UI action on resize * Remove the onResize logic that sets the height of the story inline. This removal results in the reintroduction of the issue where the layout of the story page behind the attachment shifts when the soft keyboard is open, due to the reduced viewport size. However, the removed onResize logic was preserving the story height in a way that prevents part of the story from being physically accessible in the case of mobile viewport resizes (e.g., entering split screen mode). Additionally, the logic was complex and would be somewhat difficult to reason about in the future. We may revisit this particular soft keyboard issue in the future, depending upon the attachment form usage metrics and publisher feedback * Pull out soft keyboard logic from getUIType_() into a new androidSoftKeyboardIsProbablyOpen_() method * Lint fixes * Remove onViewportResize_() logic from the draggable drawer because it is unnecessary now that we do not manually alter the story height * Remove uiState == mobile from androidSoftKeyboardIsProbablyOpen logic, and instead use the UI state within getUIType_()
- Loading branch information