   (let [data (rum/react lightbox-l)]
     (html
      [:div.lightbox
-      {:class (when (nil? data) "hide")}
+      {:class (when (nil? data) "hide")
+       :ref "parent"
+       :on-click (partial on-out-clicked own)}
       (render-lightbox data)])))
 
 (def lightbox

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


(defmethod render-lightbox :default [_] nil)

(defn- on-esc-clicked
  [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]
