Accessible Keyboard menu trigger no longer working in IE

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Accessible Keyboard menu trigger no longer working in IE

Post by JAB Creations »

Navigate to this link in IE6 or IE7...
http://www.jabcreations.com/blog/

Press the tab key to navigate with the keyboard, and then press the spacebar key to activate the menus. It would be easiest to give the login form input elements focus and then tab from there. When you activate the menus (Fiction~Web) in Firefox or Opera 9.5+ the submenus will appear and thus the menus are completely keyboard accessible. However I'm hitting some unknown error 'keyCode' is null or not an object. Thing is this works in Version 2.8 Preview II when this code was directly in the XHTML inside of an onkeypress attribute though I have modularized it since, this is now Version 2.8 Preview IV. Any way, any suggestions as to what is causing the menu scripts to break in IE? You can find the functions here...

Look for the line containing, function init28() which is called by the window.onload function in another file (these functions are required to be loaded via window.onload and thus are called via their parent function being called in the window.onload function).
Last edited by JAB Creations on Sun Jul 03, 2011 3:28 am, edited 1 time in total.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Asking people to dig through your source code instead of posting the relevant code usually leads to people skipping your thread ;)
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Post by JAB Creations »

Here is an example. Again it works if played in an onkeypress attribute but that would be messy! :wink:

Code: Select all

function init28() {
document.getElementById("menua1k").onkeypress = function(e) { if (e.keyCode == 9) return true; else change('menub1', 'menuba'); change('menub1', 'list'); }
}
Post Reply