GoogleChromeLabs / ProjectVisBug

FireBug for designers › Edit any webpage, in any state https://a.nerdy.dev/gimme-visbug
https://visbug.web.app
Apache License 2.0
5.46k stars 286 forks source link

Prevent text edits and keyboard commands from reaching the host application #464

Open chriscalo opened 4 years ago

chriscalo commented 4 years ago

Just tried to use VisBug to modify some text via VisBug in the Google Cloud Platform console, and the keys I pressed did things in the host application, including taking me to some other page. In my opinion, if VisBug handles a keyboard event, it should prevent that event from getting to the host application. Otherwise, both VisBug and the host application handle it, which is never what you want.

When I'm in text edit mode, allow me to type and prevent any of those keypress, input, etc events from getting to the host application. Similarly, if I press a keyboard shortcut that VisBug understands, that also should not reach the host application. My assumption is that event.stopPropagation() would do this, but I'm not deeply familiar with how it works.

argyleink commented 4 years ago

VisBug is using capture but if it's captured by the host logic first, then visbug cannot capture that which has already been captured. In order for Visbug to completely take all keyboard commands, it'd need to be a level higher than the page, like devtools is.

aka: i can't steal and keep what's already been stolen. Visbug is a visitor to the page, and sometimes the code there is preventing visbug from getting an effect done or, in this case, keypress management.

thanks for logging this, i'll leave it open, it'd be nice to solve one day!

chriscalo commented 4 years ago

good point, I hadn't thought about it that way.

In addition to capture, is VisBug also using event.stopPropagation()?

argyleink commented 4 years ago

yep! along with all the other friends to try and orchestrate which feature/tool owns which part of the user interaction during which combination of keys. it's all doing it the best it can, but things do leak as you've noticed.