🐛 Fix corner case on tooltip positioning

This commit is contained in:
Eva Marco
2025-08-26 16:55:26 +02:00
committed by Andrey Antukh
parent 6401b25964
commit df083cb315

View File

@@ -160,11 +160,7 @@
tooltip-brect (assoc tooltip-brect :height (or saved-height (:height tooltip-brect)) :width (or saved-width (:width tooltip-brect)))
window-size (dom/get-window-size)]
(when-let [[placement placement-rect] (find-matching-placement placement tooltip-brect origin-brect window-size offset)]
(let [height (if (or (= placement "right") (= placement "left"))
(- (:height placement-rect) arrow-height)
(:height placement-rect))]
(dom/set-data! tooltip "height" (:height tooltip-brect))
(dom/set-data! tooltip "width" (:width tooltip-brect))
(let [height (:height placement-rect)]
(dom/set-css-property! tooltip "block-size" (dm/str height "px"))
(dom/set-css-property! tooltip "inset-block-start" (dm/str (:top placement-rect) "px"))
(dom/set-css-property! tooltip "inset-inline-start" (dm/str (:left placement-rect) "px")))
@@ -253,7 +249,7 @@
:on-focus on-show
:on-blur on-hide
:on-key-down handle-key-down
:class (stl/css :tooltip-trigger)
:class [class (stl/css :tooltip-trigger)]
:aria-describedby id})
content
(if (fn? content)
@@ -262,7 +258,7 @@
[:> :div props
children
[:div {:class [class (stl/css :tooltip)]
[:div {:class (stl/css :tooltip)
:id id
:popover "auto"
:role "tooltip"}