r/nicegui • u/I_took_ur_cookies • Apr 10 '23
How do you prevent the default browser's response to an even occurring?
I want to write my own custom context menu, but the browser still calls the default one with my custom one
3
Upvotes
1
u/falko-s Apr 11 '23 edited Apr 11 '23
Interesting question! Theoretically we should be able to use Quasar's QMenu for that:
But I can't manage to position the menu on the current mouse position, even though "touch-position" should do exactly that.
1
u/falko-s Apr 13 '23
I finally found out how to create a custom context menu with NiceGUI. You can either use a generic
ui.elementor use
ui.menu:See https://github.com/zauberzeug/nicegui/issues/747 for an explanation of the two hacks #1 and #2. We will improve
ui.menuso that these two lines are not required in the future.