dasmoth / dalliance

Interactive web-based genome browser.
http://www.biodalliance.org/
BSD 2-Clause "Simplified" License
226 stars 68 forks source link

Allow keyboard events to propagate #122

Closed danvk closed 9 years ago

danvk commented 9 years ago

I'm embedding BioDalliance and would like it to go away whenever the user hits "ESC". This line prevents that: https://github.com/dasmoth/dalliance/blob/master/js/browser-ui.js#L414

Is there a reason that BioDalliance needs to stop propagation of keyboard events? Ideally it would stop propagation only when it's going to do something in response to that event.

dasmoth commented 9 years ago

The point here is that Biodalliance is doing something with ESC keypresses -- specifically, closing any open tool-panel. I suppose one solution would be to stopPropagation iff the tool panel is open. This might work quite well for you -- hit ESC once and the Biodalliance tool-panel closes, hit it again and your application gets to respond. Would this work okay?

danvk commented 9 years ago

Yes, that's exactly what I'd like Biodalliance to do!

dasmoth commented 9 years ago

Now leave escape keypresses alone unless a tool panel is open.