barmalei / zebkit

JavaScript library that follows easy OOP concept, provides HTML5 Canvas based Rich UI and includes Java to JavaScript converter tool
Apache License 2.0
931 stars 178 forks source link

Canvases managed by zebra should not stop event propagation #57

Open jeevesmkii opened 9 years ago

jeevesmkii commented 9 years ago

The Zebra code is littered with calls to Event.stopPropagation(). Web pages using Zebra UI are among the most likely to want to capture certain events globally to prevent their default effects, as well as perform other tasks. For example, to prevent the backspace key from navigating back or "ctrl-r" or the F5 key from performing a refresh. or to use "ctrl-s" to trigger a custom save routine. These handlers will never fire while a Zebra managed canvas is focused

Having to set up additional handlers per-canvas to get these events is wasteful and leads to unmanageable code.

While changing the event bubbling behaviour constitutes a major "binary" break, it should at least be made configurable in the zebra.json file, even if the default behaviour remains preventing event propagation.

djmittens commented 9 years ago

+1, im having this same issue as a different library that i use to make a game with, registers its keyboard event listeners on the window rather than the element, i cant even replay the events that i want because zebkit is hoarding all the keyboard events itself.

Here is a cool reference example why stopping propogation screws ppl over. http://css-tricks.com/dangers-stopping-event-propagation/