Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:37

Menu alignment with keypress


Poster: choltz
Dated: Monday July 25 2005 - 15:54:33 BST

The system I am working on uses Milonic menus and I am implementing keyboard support. I have added a JavaScript include to keypress.js and the keyboard works well, so long as I have this setting in SYS_MenuData.js:

Code:
openonclick=false;

However, if I change this value to true, then using the keyboard opens all of the menus in the very upper left corner of the browser. I've installed our application on a public server so that you can see the behavior I am describing. The web application can be found here:

http://horizon.sumtotalsystems.com/sumtotal

The user name is "user1" and the password is "password". After logging in, the page displayed has the menu with the keyboard problem. Just tab around and you should see that the menu opens in the upper left corner of the browser instead of aligned with the parent menu item.

If you have any feed back, I'd really appreciate it.

Thanks!
- Chris


Poster: Ruth
Dated: Monday July 25 2005 - 19:18:16 BST

Hi Chris,

I'm not a programmer or webpage designer so my explanation is kind of everyday rather than technical. What's happening is this:

In the programming the menu is set to open on mouseover by default. When you set it to openonclick, that means that you now require that not only do you 'mouseover' which initiates things like onbgcolor etc, but the person now has to perform another action i.e. click with the mouse to initiate the opening of the submenu.

When you add the keypress so the menu can be tabbed, if you don't have the openonclick=true; each time you tab an item is highlighted and if it has a submenu that submenu is opened since the mouseover is the default. Once you set the openonclick, when you tab to say 'Access' in your main menu, the program is waiting for a click, with the keypress that click would be to hit enter, but you have no way to tell the person that they need to now hit enter to open the submenu.

As to your problem, what's happening is, when you tab and it gets to the Access item, Acess submenu doesn't open because it's set to openonclick, but the tab continues down that submenu and when it gets to the Alternate Job Analysis item, that submenu, since that is not openonclick, opens, but since it doesn't have a 'main' menu position from which to position itself it opens at the top/left of the browser.

I've not been able to find any way to get the keypress to open a submenu if it is set to openonclick.

Ruth

Excellent response, thank you


Poster: choltz
Dated: Monday July 25 2005 - 23:45:39 BST

Thank you for the very informative response. I now understand the reasoning behind the behavior in the menu.

With openonclick=false, is there any way to tab across the top menu items with the keyboard instead of causing the sub-menus to open? That way when I get to the access menu with the keyboard, I can click enter to open the menu, but if I just continue tabbing instead of clicking enter, I would continue to move focus to the next top-level menu item instead of opening sub menus.


Poster: Ruth
Dated: Tuesday July 26 2005 - 1:18:31 BST

Hi Chris,

As far as I know there is no way to do what you want. In essense that is asking the keypress to decide that the openonclick is false so therefore don't open a menu, skip it unless someone hits enter, which is opposite of what it is supposed to do. As far as I know there's no way to tell it to skip submenus attached to main menu items unless x happens.

I don't know if it would be possible to write a function telling the keypress that if openonclick=true; do not scroll submenus unless enter has been clicked. And then the function would have to be applied to the main menu only, or you might have to set up so that all submenus would only open on click. Which I think would be the way you want it to work. Again, you'd have to make sure that everyone knew that the tab would be working differently than using the tab would normally work. But, that's the only thing I can think might be an option if a function is possible and I have no idea if that is possible.

Sorry :(

Ruth

I may have a solution


Poster: choltz
Dated: Tuesday July 26 2005 - 3:58:14 BST

Thanks for the info. Actually, I got inside of keypress.js and made a few code adjustments. I found the part of the code that would normally open a top-level menu on a tab keypress and instead invoked the code that moves to the next top-level menu. I did the same for the code that executes when alt-tab is pressed.

If the enter key is pressed, the menu behaves normally and opens up the submenu. I can then use they arrow keys to navigate through the menu structure. This is all with openonclick=false.

The other quirk is I wanted a key sequence to force focus to the menu from anywhere in the page; this seems to be working now also.

Thanks so much for the input - you put me on path and in the right direction.


Poster: Ruth
Dated: Tuesday July 26 2005 - 4:18:11 BST

Hi,

Just wanted to say that your site is telling me it doesn't support my browser [ie5.5] but it sure seems to work fine with it :). though I'm not getting any of the behaviour you said was occuring after you modified the keypress file.

Also, you might want to contact milonic about what you did and the thought behind it. I'm not sure about modifying modules. It may break your support from Milonic, though probably not if you notify them. But, I'm a volunteer so I don't really know the policy.

Ruth