Saturday, May 2, 2015

Prevent default event for Ctrl + O shortcut in IE11




Prevent default behavior for Ctrl + O shortcut in IE11


If you are working on a web application that wants to use some complex shortcuts you have to take into account some browsers' limitations. 

For me a minor limitation I've come across was the shortcut Ctrl + O. It's kindda strange that you cannot prevent default browser behavior for such shortcut. 

I've checked some popular libraries like e.g. KeyboardJS, or KeypressJS but to no avail.

You can check the two experiments made:
http://dstefaniak-staging.com/tests/keyboard/KeyboardJS-master/experiment.html
http://dstefaniak-staging.com/tests/keyboard/Keypress/experiment.html

There is an official issue added to Internet Explorer Feedback site:
https://connect.microsoft.com/IE/feedback/details/1046712/javascript-interception-and-termination-of-some-key-events-is-broken

However, from 13 Jan 2015 there was no feedback whether or when this is going to be fixed. Workarounds that were suggested on IE feedback page and any other forums e.g. this one doesn't seem to work (not for me at least).

If you are one of the devs that have the same problem don't forget to click "Repros" button after signing in confirming that you were able to reproduce the behavior.

Even though I think that IE11 is in many aspects better than Firefox, (definitely) Safari this is one of the examples where you to bang your head against a wall.

No comments:

Post a Comment