                                  )))
 
 (defn focus! []
-  (->> (dom/$$ :.focused)
-       (last)
-       (.focus)))
+  (when-let [cur (last (dom/$$ :.focused))]
+    (.focus cur)))
 
 ;;*********************************************************
 ;; Go!

                           :ref ref
                           :args args}
                      opts)))

(defn ref-id [id]
  {:type :ref/id

(defn ref-menu [step & [cb]]
  (fn [e]
    (when (mutable? step)
      (show-menu! e (concat [{:label "table!"
                              :action (fn []
                                        (swap! step (constantly (table)))
                                        (when cb
                                           (cb)))}]
                            (for [ref (refs-in-scope (current :page) (current :step))]
                              {:label (subs ref 0 5)
                               :action (fn []
                                         (swap! step (constantly (ref-id ref)))
                                         (when cb
                                           (cb)))}))))))

(defmethod item-ui :ref/id [step]
  (dom
