fix: prevent scroll reset when hovering over hidden annotation

Keep button container always rendered but use visibility:hidden to hide
buttons instead of conditionally rendering them. This preserves DOM
structure and prevents scroll position reset on hover.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
Your Name 2026-06-30 16:51:35 -04:00
parent 06b28e2a9c
commit 89533a13cd

View file

@ -817,13 +817,12 @@
[:span.ann-title {:style {:font-size 10}}
[:span.ann-swatch {:style {:background (:color a)}}]
(:name a)]
(when @hov?
[:div {:style {:display "flex" :gap "2px"}}
[:div {:style {:display "flex" :gap "2px" :visibility (if @hov? "visible" "hidden")}}
[:button.expand-btn {:title "Expand" :on-click #(rf/dispatch [::events/expand (:id a)])}
"⤢"]
[:button.edit-btn {:title "Edit"
:on-click #(rf/dispatch [::events/edit-draft (:id a)])}
"✎"]])])
"✎"]]])
;; Normal annotation: full card
[:div.ann {:id (str "ann-" (name (:id a)))
:class (when (contains? active-set (:id a)) "active")