🐛 Fix text selection on Safari 18/26 (wasm)

This commit is contained in:
Belén Albeza 2026-03-26 18:07:00 +01:00 committed by Alonso Torres
parent 153277d152
commit e9d30bf2c1
2 changed files with 15 additions and 5 deletions

View File

@ -27,7 +27,7 @@
;; --- Auxiliar Functions
(def valid-browsers
#{:chrome :firefox :safari :safari-16 :safari-17 :edge :other})
#{:chrome :firefox :safari :safari-16 :safari-17 :safari-18 :safari-26 :edge :other})
(def valid-platforms
#{:windows :linux :macos :other})
@ -40,13 +40,17 @@
check-edge? (fn [] (str/includes? user-agent "edg"))
check-safari? (fn [] (str/includes? user-agent "safari"))
check-safari-16? (fn [] (and (check-safari?) (str/includes? user-agent "version/16")))
check-safari-17? (fn [] (and (check-safari?) (str/includes? user-agent "version/17")))]
check-safari-17? (fn [] (and (check-safari?) (str/includes? user-agent "version/17")))
check-safari-18? (fn [] (and (check-safari?) (str/includes? user-agent "version/18")))
check-safari-26? (fn [] (and (check-safari?) (str/includes? user-agent "version/26")))]
(cond
^boolean (check-edge?) :edge
^boolean (check-chrome?) :chrome
^boolean (check-firefox?) :firefox
^boolean (check-safari-16?) :safari-16
^boolean (check-safari-17?) :safari-17
^boolean (check-safari-18?) :safari-18
^boolean (check-safari-26?) :safari-26
^boolean (check-safari?) :safari
:else :unknown)))

View File

@ -364,7 +364,7 @@
;; NOTE: this teoretically breaks hooks rules, but in practice
;; it is imposible to really break it
maybe-zoom
(when (cf/check-browser? :safari-16)
(when (or (cf/check-browser? :safari) (cf/check-browser? :safari-26) (cf/check-browser? :safari-18))
(mf/deref refs/selected-zoom))
shape (cond-> shape
@ -420,17 +420,23 @@
;; Transform is necessary when there is a text overflow and the vertical
;; aligment is center or bottom.
(and (not render-wasm?)
(not (cf/check-browser? :safari)))
(not (cf/check-browser? :safari-16)))
(obj/merge!
#js {:transform (dm/fmt "translate(%px, %px)" (- (dm/get-prop shape :x) x) (- (dm/get-prop shape :y) y))})
(cf/check-browser? :safari-17)
(or (cf/check-browser? :safari-18) (cf/check-browser? :safari-26) (cf/check-browser? :safari-17))
(obj/merge!
#js {:height "100%"
:display "flex"
:flexDirection "column"
:justifyContent (shape->justify shape)})
(or (cf/check-browser? :safari-26) (cf/check-browser? :safari-18))
(obj/merge!
#js {:position "fixed"
:transform-origin "top left"
:transform (dm/fmt "scale(%)" maybe-zoom)})
(cf/check-browser? :safari-16)
(obj/merge!
#js {:position "fixed"