feat(dialog): close dialog on backdrop click
Add click handlers to the dialog component for all three targets that
close the dialog when clicking the backdrop area (outside the dialog box).
Uses event.target === event.currentTarget to distinguish backdrop clicks
from content clicks.
- :clj — inline onclick attribute
- :cljs — Replicant :on {:click handler}
- :squint — :on-click handler
- CSS: cursor: pointer on ::backdrop for affordance
This commit is contained in:
@@ -15,7 +15,12 @@
|
||||
|
||||
(testing "open dialog has open attr"
|
||||
(let [result (dialog/dialog {:open true} "Content")]
|
||||
(is (true? (get-in result [1 :open]))))))
|
||||
(is (true? (get-in result [1 :open])))))
|
||||
|
||||
(testing "dialog has backdrop close handler"
|
||||
(let [result (dialog/dialog {} "Content")]
|
||||
(is (string? (get-in result [1 :onclick])))
|
||||
(is (clojure.string/includes? (get-in result [1 :onclick]) "close")))))
|
||||
|
||||
(deftest dialog-sections-test
|
||||
(testing "dialog-header renders header"
|
||||
|
||||
Reference in New Issue
Block a user