Probably you can inject your js and add an input event in the body of the page.
Firefox
A place to discuss the news and latest developments on the open-source browser Firefox
To detect two keystrokes closely followed, you can use EventListener
s for the onkeyup
/onkeydown
event. In combination with a variable that determines if the key was already pressed within the last 100 ms and a setTimeout
call that resets that variable after 100 ms, it should be fairly easy to accomplish.
If you just need to intercept the keypresses in webpages then you can inject a content script and handle these. However there is no way with the new WebExtensions API to intercept browser chrome events.
Additionally there is no way to delay events. So if you want to suppress both shift presses you will struggle to do that. If you are ok to let the first one go through suppressing the second one is trivial.