Skip to content

Commit

Permalink
do not dispatch route with modifier keys pressed
Browse files Browse the repository at this point in the history
  • Loading branch information
edvorg committed Nov 9, 2015
1 parent 6e814ee commit 1eff0f8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/accountant/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,15 @@
"click"
(fn [e]
(let [button (.-button e)
meta-key (.metaKey e)
alt-key (.altKey e)
ctrl-key (.ctrlKey e)
shift-key (.shiftKey e)
any-key (or meta-key alt-key ctrl-key shift-key)
href (find-href e)
path (.getPath (.parse Uri href))
title (.-title (.-target e))]
(when (and (= button 0) (secretary/locate-route path))
(when (and (not any-key) (= button 0) (secretary/locate-route path))
(. history (setToken path title))
(.preventDefault e))))))

Expand Down

0 comments on commit 1eff0f8

Please sign in to comment.