j-delaney / back-to-backspace

https://chrome.google.com/webstore/detail/back-to-backspace/cldokedgmomhbifmiiogjjkgffhcbaec
MIT License
45 stars 14 forks source link

Activating backspace on event bubbling instead of capture #18

Open hfhchan opened 8 years ago

hfhchan commented 8 years ago

Currently, the scripts checks the focused elements upon the page then performs the navigation against a blacklist.

Except that some sites use wonky ways of detecting keystrokes without using the blacklisted tags, or uses object / embed.

Instead, maybe the backspace handler should be issued on event bubbling on window, and check for isDefaultPrevented. This will make the event handler not interfere with pages which already have scripts intercepting the backspace key.

Additionally, a setTimeout closure could be set with timeout 0 inside the handler to ensure the checking happens strictly after all other handlers have fired.