0

onClick event Navbar(Navitem) not fire in Mobile Device

asked 2022-02-04 19:25:29 +0800

manuela0000 gravatar image manuela0000
5 1

Hello! I've a problem. I've used a navbar with two navitem. When I use in desktop, everything is ok, but when I used it on tablet and I click on a navitem, the onClick event is not fired.

This is my code in zul:

<navbar>
    <navitem id="navItemServizi" selected="true"/>
    <navitem id="navItemCategorie" selected="false" sclass="navbar-item-not-selected"/>
</navbar>

This is my code in java:

//called in desktop, not called in Tablet
    public void onClick$navItemServizi() {
        Utils.getDebug(this.getClass(),Thread.currentThread());
        selectedVisuale = SERVIZI;
    }
    public void onClick$navItemCategorie() {
        Utils.getDebug(this.getClass(),Thread.currentThread());
        selectedVisuale = CATEGORIE;
    }

What am I wrong? Thanks a lot in advance!

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-02-07 16:43:47 +0800

MDuchemin gravatar image MDuchemin
2228 1 5
ZK Team

Hi there,

I've tested your code locally with zk 9.6.1, and it works for me on Laptop, tablet (iOS chrome and safari) and mobile (chrome on android).

There could be an initialization issue on your tablet, or the touch event could be intercepted by an outer component with higher priority. (that could happen if a parent or ancestor of the navItem also has touch behaviors, such as drag on a panel or a window, or other touch active container). A simple way to test this out would be to make a copy of the exact same code in a simplified page with only a div around your target nav.

If this work without the other ancestors, then one of them is catching touch events.

You should also check your zk.xml library properties, in case you got a disabled touch property in there, as this could have an effect on how the touch events are handled.

link publish delete flag offensive edit

Comments

Tha you for the answer. I've just found that it's not working on Chrome. Instead, it's working on Safari. Do you know if there is some problem with chrome?

manuela0000 ( 2022-02-08 22:54:34 +0800 )edit

If you are using chrome or safari, I assume that you are using iOS? AFAIK there is no specific issue with onClick event on iOS chrome, but the iOS browsers are not using the same architecture on iOS as they do on other devices, so there could be something specific there.

MDuchemin ( 2022-02-10 17:24:03 +0800 )edit

If you can create a reproducing https://zkfiddle.org/ sample, I'd be very happy to test it on my side on iOS chrome and safari. Without a reproducing sample however, it's very difficult to pinpoint what could be going wrong.

MDuchemin ( 2022-02-10 17:25:10 +0800 )edit

Thanks a lot for your help, I really apprecciate it. At the end, I'v transformed all the "navbar items" in simple buttons. In this way I don't have problem. Thanks again.

manuela0000 ( 2022-02-18 18:34:17 +0800 )edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2022-02-04 19:25:29 +0800

Seen: 6 times

Last updated: Feb 07

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More