Fork me on GitHub

In Chrome on Win 8 touchscreen, If I do a long touch, the browser's contextual menu pops up. I would like to suppress the default context menu, so I can can use touch events more reliably. And hopefully implement my own contextual menus and long-press options. How would I go about this? I am using Hoplon UI, which has a (window) function for the main view, instead of (body)... but I'm assuming this would not prohibit me from modifying this behavior.


I have this so far

(.addEventListener js/window "contextmenu"
    (fn [e] (.-preventDefault js/window)))
But no luck yet. And where would I put it?


Hoplon UI provides attributes for "auxclick" and "contextmenu" events. But I dont know how to go about suppressing the default browser menu.


Is there a way to add this behavior ad hoc, without modifying the UI library?


Got it! :ctx-menu #(.preventDefault %) in attrs works. I can apply this to (window) for a global reset. Then override on elems as needed. Nice and simple. Hoplon is awesome!!! I can do so much with about zero javascript experience.