Skip to content

Commit 94e07c5

Browse files
committed
fix: show card preview on button hover too
This PR changes the preview to work on buttons, given the only child of that button would have triggered a preview. I don't feel super confident this is the right approach, but `nr.utils/card-patterns-impl` is used in a lot of places and it felt risky to edit it. Fix #8488
1 parent 1988858 commit 94e07c5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/cljs/nr/gameboard/card_preview.cljs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,15 @@
44

55
(defonce zoom-channel (chan))
66

7+
(defn- safe-get-attribute [target attribute]
8+
(when (.-getAttribute target)
9+
(.getAttribute target attribute)))
10+
711
(defn- get-card-data-title [e]
812
(let [target (.. e -target)
9-
title (.getAttribute target "data-card-title")]
13+
title (or (safe-get-attribute target "data-card-title")
14+
(when (= "BUTTON" (.-tagName target))
15+
(some-> target .-firstChild (safe-get-attribute "data-card-title"))))]
1016
(not-empty title)))
1117

1218
(defn put-game-card-in-channel

0 commit comments

Comments
 (0)