Click on a navbar item event

Hi. in my project (V24) I’ve implemented a navbar with a drawer for my menu, like in the vaadin start project.
How can I intercept the event when the user click on an item of the menu ?

Implement BeforeEnterObserver and Override public void beforeEnter(BeforeEnterEvent event) in your main layout

It probably depends on what you want to do, but using the navigation event is a good way for this.
Doing it on the click is probably wrong since it can be easily skipped (by copy/pasting the url for example)

Thank you It works fine

I want to intercept the event in order to inform the user if he want to quit the view while he has done change on the screen without saving…

BeforeLeave is the best event for this: How do I warn user when leaving a modified form - Vaadin Cookbook

Yes okay thank you. With this method I have less code to handle. :wink: I’m going to implement this method in all my app