Skip to content

Commit 92eb5ac

Browse files
committed
fix: menu popup on mobile
1 parent eb2429d commit 92eb5ac

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

src/main/mobile/components/app.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,3 +308,8 @@ body, #root {
308308
display: initial;
309309
}
310310
}
311+
312+
div[data-radix-menu-content] {
313+
@apply overflow-y-auto;
314+
padding-bottom: 80px;
315+
}

src/main/mobile/components/popup.cljs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
[mobile.state :as mobile-state]
1010
[rum.core :as rum]))
1111

12-
(defonce *last-popup-modal? (atom nil))
12+
(defonce *last-popup? (atom nil))
1313
(defonce *last-popup-data (atom nil))
1414

1515
(defn- popup-min-height
@@ -84,7 +84,7 @@
8484
(assoc-in [:content-props :side] side))))
8585

8686
(defn popup-show!
87-
[event content-fn {:keys [id] :as opts}]
87+
[event content-fn {:keys [id dropdown-menu?] :as opts}]
8888
(cond
8989
(and (keyword? id) (= "editor.commands" (namespace id)))
9090
(let [opts (wrap-calc-commands-popup-side event opts)
@@ -93,11 +93,17 @@
9393
_ (when max-h (js/document.documentElement.style.setProperty
9494
(str "--" side "-popup-content-max-height") (str max-h "px")))
9595
pid (shui-popup/show! event content-fn opts)]
96-
(reset! *last-popup-modal? false) pid)
96+
(reset! *last-popup? false)
97+
pid)
98+
99+
dropdown-menu?
100+
(let [pid (shui-popup/show! event content-fn opts)]
101+
(reset! *last-popup? false)
102+
pid)
97103

98104
:else
99105
(when content-fn
100-
(reset! *last-popup-modal? true)
106+
(reset! *last-popup? true)
101107
(when (mobile-util/native-ios?)
102108
(let [data {:open? true
103109
:content-fn content-fn
@@ -114,7 +120,7 @@
114120
(mobile-state/set-tab! "home"))
115121

116122
:else
117-
(if (and @*last-popup-modal? (not (= (first args) :editor.commands/commands)))
123+
(if (and @*last-popup? (not (= (first args) :editor.commands/commands)))
118124
(dismiss-native-sheet!)
119125
(apply shui-popup/hide! args))))
120126

0 commit comments

Comments
 (0)