This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-10-26
Channels
- # aws (1)
- # aws-lambda (16)
- # beginners (8)
- # boot (2)
- # cider (4)
- # cljsrn (9)
- # clojure (137)
- # clojure-italy (3)
- # clojure-russia (39)
- # clojure-spec (34)
- # clojure-uk (33)
- # clojurescript (44)
- # core-logic (11)
- # cursive (27)
- # data-science (16)
- # datomic (52)
- # duct (1)
- # emacs (1)
- # figwheel (2)
- # fulcro (90)
- # graphql (3)
- # hoplon (7)
- # lambdaisland (2)
- # leiningen (23)
- # lumo (1)
- # off-topic (1)
- # om (40)
- # onyx (44)
- # re-frame (116)
- # reagent (3)
- # shadow-cljs (87)
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.
(window)
src: https://github.com/jumblerg/ui/blob/cbdc3e7980ac59f527fb10c47d847f3d99feb335/lib/src/hoplon/ui.cljs#L587
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.