Browse Source

fix: mobile menus will position off screen, clipped #1068

charlie 4 years ago
parent
commit
11a40833a3

+ 8 - 0
src/main/frontend/components/editor.css

@@ -42,6 +42,14 @@
   }
 }
 
+.is-mobile {
+  .absolute-modal {
+    &.is-overflow-vw-x {
+      transform: translateX(-1%);
+    }
+  }
+}
+
 .non-block-editor textarea,
 pre {
   display: block;

+ 1 - 0
src/main/frontend/ui.cljs

@@ -228,6 +228,7 @@
   (let [cl (.-classList js/document.documentElement)]
     (if util/mac? (.add cl "is-mac"))
     (if (util/ios?) (.add cl "is-ios"))
+    (if (util/mobile?) (.add cl "is-mobile"))
     (if (util/safari?) (.add cl "is-safari"))))
 
 (defn inject-dynamic-style-node!

+ 5 - 0
src/main/frontend/util.cljs

@@ -40,6 +40,11 @@
     (and (string/includes? ua "webkit")
          (not (string/includes? ua "chrome")))))
 
+(defn mobile?
+  []
+  (when-not node-test?
+    (re-find #"Mobi" js/navigator.userAgent)))
+
 (defn format
   [fmt & args]
   (apply gstring/format fmt args))