diff --git a/github-users-web-client/src/main/java/com/xemantic/ankh/Elements.java b/github-users-web-client/src/main/java/com/xemantic/ankh/Elements.java index 45d48b1..84c1bbf 100644 --- a/github-users-web-client/src/main/java/com/xemantic/ankh/Elements.java +++ b/github-users-web-client/src/main/java/com/xemantic/ankh/Elements.java @@ -25,6 +25,7 @@ import com.intendia.rxgwt.elemental2.RxElemental2; import com.xemantic.githubusers.logic.eventbus.Trigger; import elemental2.dom.Element; +import elemental2.dom.Event; import elemental2.dom.HTMLButtonElement; import elemental2.dom.HTMLElement; import mdc.ripple.MDCRipple; @@ -47,7 +48,10 @@ public Elements(Element element) { public static Observable observeClicksOf(Element element) { Objects.requireNonNull(element); - return RxElemental2.fromEvent(element, RxElemental2.click).map(e -> Trigger.INSTANCE); + MDCRipple.attachTo(element); + return RxElemental2.fromEvent(element, RxElemental2.click) + .doOnNext(Event::preventDefault) + .map(e -> Trigger.INSTANCE); } public static void removeChildren(Element element) { @@ -62,14 +66,12 @@ public HTMLElement get(String selector) { } public HTMLButtonElement getButton(String selector) { - HTMLButtonElement button = (HTMLButtonElement) element.querySelector(selector); - MDCRipple.attachTo(button); - return button; + return (HTMLButtonElement) get(selector); } public Observable observeClicksOf(String selector) { - Element child = element.querySelector(selector); - return RxElemental2.fromEvent(child, RxElemental2.click).map(e -> Trigger.INSTANCE); + Element child = get(selector); + return observeClicksOf(child); } } diff --git a/github-users-web-client/src/main/java/com/xemantic/githubusers/web/view/templates.soy b/github-users-web-client/src/main/java/com/xemantic/githubusers/web/view/templates.soy index 07b11a7..e4202cb 100644 --- a/github-users-web-client/src/main/java/com/xemantic/githubusers/web/view/templates.soy +++ b/github-users-web-client/src/main/java/com/xemantic/githubusers/web/view/templates.soy @@ -35,12 +35,13 @@
- menu + menu
search
@@ -83,16 +84,16 @@