 (defmethod render-lightbox :default [_] nil)
 
 (defn- on-esc-clicked
-  [e]
-  (when (k/esc? e)
-    (udl/close!)))
+  [event]
+  (when (k/esc? event)
+    (udl/close!)
+    (dom/stop-propagation event)))
+
+(defn- on-out-clicked
+  [own event]
+  (let [parent (mx/get-ref-dom own "parent")
+        current (dom/get-target event)]
+    (when (dom/equals? parent current)
+      (udl/close!))))
 
 (defn- lightbox-will-mount
   [own]

  (let [data (rum/react lightbox-l)]
    (html
     [:div.lightbox
      {:class (when (nil? data) "hide")}
      (render-lightbox data)])))

(def lightbox

            [uxbox.data.lightbox :as udl]
            [uxbox.ui.mixins :as mx]
            [uxbox.ui.keyboard :as k]
            [uxbox.util.dom :as dom]
            [goog.events :as events])
  (:import goog.events.EventType))

