UX: Fix composer position on iPads with a hardware keyboard

UX: Fix composer position on iPads with a hardware keyboard

Adds padding to the composer when the keyboard accessory bar is shown (i.e. submit button no longer hides behind said bar)

diff --git a/app/assets/javascripts/discourse/components/composer-body.js b/app/assets/javascripts/discourse/components/composer-body.js
index 1bd4c63..80bb8d3 100644
--- a/app/assets/javascripts/discourse/components/composer-body.js
+++ b/app/assets/javascripts/discourse/components/composer-body.js
@@ -156,6 +156,23 @@ export default Component.extend(KeyEnterEscape, {
       "--composer-vh",
       `${composerVH}px`
     );
+
+    const viewportWindowDiff =
+      window.innerHeight - window.visualViewport.height;
+
+    // adds bottom padding when using a hardware keyboard and the accessory bar is visible
+    // accessory bar height is 55px, using 75 allows a small buffer
+    if (viewportWindowDiff > 0 && viewportWindowDiff < 75) {
+      document.documentElement.style.setProperty(
+        "--composer-ipad-padding",
+        `${viewportWindowDiff}px`
+      );
+    } else {
+      document.documentElement.style.setProperty(
+        "--composer-ipad-padding",
+        "0px"
+      );
+    }
   },
 
   didInsertElement() {
diff --git a/app/assets/stylesheets/common/base/compose.scss b/app/assets/stylesheets/common/base/compose.scss
index 7dca1ac..d67224c 100644
--- a/app/assets/stylesheets/common/base/compose.scss
+++ b/app/assets/stylesheets/common/base/compose.scss
@@ -18,7 +18,7 @@
   }
   z-index: z("composer", "content");
   transition: height 250ms ease, background 250ms ease, transform 250ms ease,
-    max-width 250ms ease;
+    max-width 250ms ease, padding-bottom 250ms ease;
   background-color: $secondary;
   box-shadow: shadow("composer");
 
@@ -496,3 +496,9 @@ body.ios-safari-composer-hacks {
     }
   }
 }
+
+body:not(.ios-safari-composer-hacks) {
+  #reply-control.open {
+    padding-bottom: var(--composer-ipad-padding);
+  }
+}

GitHub sha: 92e81d2a