Changes

Jump to: navigation, search

BigBlueButton Accessibility Instructions

3,923 bytes added, 14:02, 3 March 2013
Local Shortcuts
===Local Shortcuts===
Adding local shortcuts to your module is a more involved process, as you need to build the framework that is already present for global shortcuts. We'll start in the MDIWindow for your module.
 
'''NOTE: Some modules, like the Chat module, have a more complex structure with specific hotkeys for each one. If your module is built in a similar manner, you will need to repeat this for each MXML in your module which dispatches it's own shortcuts.'''
 
Make sure you've imported org.bigbluebutton.main.events.ShortcutEvent into the MXML file, and declare an instance variable of class Dispatcher. You've already set up a method bound to creationComplete of your MDIWindow when you set up the Tab Order earlier in this guide; instantiate the Dispatcher to new Dispatcher() in that method. Now, make sure that your MXML has a loadKeyCombos method. If not, add one like so: (still working with our example of the Opinion module)
<pre>
private function loadKeyCombos(modifier:String):void {
keyCombos = new Object(); // always start with a fresh array
keyCombos[modifier+(ResourceUtil.getInstance().getString('bbb.shortcutkey.opinion.focusInput') as String)] = ShortcutEvent.FOCUS_OPINION_INPUT;
keyCombos[modifier+(ResourceUtil.getInstance().getString('bbb.shortcutkey.opinion.submit') as String)] = ShortcutEvent.OPINION_SUBMIT;
}
</pre>
 
Notice that we are still using the string from the locale file that contains the ASCII code for whichever key is used in the shortcut. Much like how we set up an array to populate the Help window DataGrid to display information about our hotkeys, this sets up this part of your module with an Object full of keycodes to watch out for. Next, add a hotKeyCapture() method which will add a keyDown listener to the module, as well as a locale-change listener in case the user switches the language they're operating in:
<pre>
private function hotkeyCapture():void{
this.addEventListener(KeyboardEvent.KEY_DOWN, handleKeyDown);
ResourceUtil.getInstance().addEventListener(Event.CHANGE, localeChanged); // Listen for locale changing
}
</pre>
 
Return to your creationComplete method, and after the Dispatcher has been instantiated, call your new hotKeyCapture() method. This makes sure the listeners are in place as soon as the application is done loading.
 
Finally, one last method to bring everything together: the handleKeyDown() method from the keyDown listener:
<pre>
private function handleKeyDown(e:KeyboardEvent) :void {
var modifier:String = ExternalInterface.call("determineLocalModifier");
loadKeyCombos(modifier);
var keyPress:String = (e.ctrlKey ? "control+" : "") +
(e.shiftKey ? "shift+" : "") +
(e.altKey ? "alt+" : "") + e.keyCode;
if (keyCombos[keyPress]) {
disp.dispatchEvent(new ShortcutEvent(keyCombos[keyPress]));
}
}
</pre>
 
This is where it all comes together. When the user presses a key, the listener catches the event, and determines which modifier it should be looking for with a call to a simple piece of JavaScript which determines which browser the user is running. It then calls the loadKeyCombos method and passes in that modifier; loadKeyCombos brings in the ASCII codes from the locale file and plugs them into the keyCombos object. Control returns to handleKeyDown, which compares the keys being pressed to the key combinations present in keyCombos. If one of those combinations matches, it uses the Dispatcher (disp, in our example) to dispatch the event to the application. Because the keyDown listener was added to the "this" scope rather than to the global "stage," these events are only dispatched when you are in the appropriate scope.
 
Listening for these events is done the same way as for global shortcuts, with a <mate:Listener> tag in the MXML file where the hotkey is meant to take effect.
===Testing===
Testing your shortcuts happens in two stages. First, you need to make sure that your hotkey combinations call the correct methods and actually do what they're supposed to do and how they're supposed to do it. Second, you need to make sure that your hotkeys are available in the correct scope. Global hotkeys, of course, should work as long as the Flash application has focus. If you can move focus into the Chat module and still use the local hotkey you set up for your custom module, something has gone wrong.
1
edit

Navigation menu