Sunday, December 9, 2012

Advanced hotkeys in ADF.

In this post I'm going to share a way to get a fully functional hotkeys support in ADF applications.
AccessKey property has many restrictions which I don't like:
  • it is a browser specific feature (accessKey is triggered by browser-specific and platform-specific modifier keys. It even has browser-specific meaning. For example, Internet Explorer 7.0 will set focus when you press Alt+. Firefox 2.0 on some operating systems you press Alt+Shift+. Firefox 2.0 on other operating systems you press Control+);
  • I can't have hotkeys like Ctrl+Space;
  • I can't trigger particular events;
  • I can't set several hotkeys for one component;
  • and so on.
So I've written a script which gives me ability to circumvent this restrictions and easily add hotkeys (and one auxiliary script which provides methods to obtain af:document component, attach listeners to dom elements in different browsers and initialize my custom libraries when document is loaded).