🐛 [Attachment Forms] Maintain the mobile UI layout when the soft keyboard opens or closes (#35908)
🐛 [Attachment Forms] Maintain the mobile UI layout when the soft keyboard opens or closes (#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_()
jridgewell/amphtml,jridgewell/amphtml,danielrozenberg/amphtml,alanorozco/amphtml,danielrozenberg/amphtml,Gregable/amphtml,danielrozenberg/amphtml,honeybadgerdontcare/amphtml,Gregable/amphtml,Gregable/amphtml,jpettitt/amphtml,alanorozco/amphtml,alanorozco/amphtml,danielrozenberg/amphtml,mhc-gh/amphtml,media-net/amphtml,jridgewell/amphtml,mhc-gh/amphtml,jpettitt/amphtml,media-net/amphtml,jridgewell/amphtml,jridgewell/amphtml,mhc-gh/amphtml,ampproject/amphtml,honeybadgerdontcare/amphtml,mhc-gh/amphtml,alanorozco/amphtml,media-net/amphtml,honeybadgerdontcare/amphtml,jridgewell/amphtml,media-net/amphtml,alanorozco/amphtml,jridgewell/amphtml,ampproject/amphtml,alanorozco/amphtml,danielrozenberg/amphtml,ampproject/amphtml,jpettitt/amphtml,danielrozenberg/amphtml,jpettitt/amphtml,ampproject/amphtml,Gregable/amphtml,ampproject/amphtml,media-net/amphtml,honeybadgerdontcare/amphtml,ampproject/amphtml,ampproject/amphtml,media-net/amphtml,Gregable/amphtml,jpettitt/amphtml,jpettitt/amphtml,mhc-gh/amphtml,ampproject/amphtml,jpettitt/amphtml,danielrozenberg/amphtml,media-net/amphtml,mhc-gh/amphtml,Gregable/amphtml,honeybadgerdontcare/amphtml,media-net/amphtml,danielrozenberg/amphtml,alanorozco/amphtml,Gregable/amphtml,honeybadgerdontcare/amphtml,honeybadgerdontcare/amphtml,Gregable/amphtml,mhc-gh/amphtml,jpettitt/amphtml,alanorozco/amphtml,mhc-gh/amphtml