node-menunav-debug.js revision ce06fcd5562d725b60692d44fd9deef967a3276c
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* <p>The MenuNav Node Plugin makes it easy to transform existing list-based markup into traditional,
14b1e9d6653e5b6ec6b2fbd4e30faaf3a74b6cf7Todd Kloots* drop down navigational menus that are both accessible and easy to customize, and only require
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* a small set of dependencies.</p>
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* <p>To use the MenuNav Node Plugin, simply pass a reference to the plugin to a Node instance's
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* <code>plug</code> method.</p>
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* var oMenuNav = Y.Node.get("#productsandservices");<br>
fab450bda25d83fc914a6413dcd83d3c9919282dTodd Kloots* oMenuNav.plug(Y.plugin.NodeMenuNav);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* <p>The MenuNav Node Plugin has several configuration properties that can be set via an
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* object literal that is passed as a second argument to a Node instance's <code>plug</code> method.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* var oMenuNav = Y.Node.get("#productsandservices");<br>
fab450bda25d83fc914a6413dcd83d3c9919282dTodd Kloots* oMenuNav.plug(Y.plugin.NodeMenuNav, { mouseOutHideDelay: 1000 });
5704a55c960a1cb578bb2a13dc757d31b8b45a11Todd Kloots* <p> The complete list of the MenuNav Node Plugin configuration properties are:</p>
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* <dt>useARIA</dt>
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* <dd>Boolean indicating if use of the WAI-ARIA Roles and States should be enabled for the
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* MenuNav. Set to true by default for Firefox 3 and Internet Explorer 8 as currently only
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* these browsers have support for ARIA, and are supported by several screen readers for
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* Windows that also offer support for ARIA.</dd>
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* <dt>autoSubmenuDisplay</dt>
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* <dd>Boolean indicating if submenus are automatically made visible when the user mouses over
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* the menu's items. Set to true by default.</dd>
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* <dt>submenuShowDelay</dt>
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* <dd>Number indicating the time (in milliseconds) that should expire before a submenu is
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* made visible when the user mouses over the menu's label. Set to 250 by default.</dd>
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* <dt>submenuHideDelay</dt>
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* <dd>Number indicating the time (in milliseconds) that should expire before a submenu is
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* hidden when the user mouses out of a menu label heading in the direction of a submenu.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* Set to 250 by default.</dd>
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* <dt>mouseOutHideDelay</dt>
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* <dd>Number indicating the time (in milliseconds) that should expire before a submenu is
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* hidden when the user mouses out of it. Set to 750 by default.</dd>
8a4137ab24ac4a19400c698a65cf8ca511b081c5Todd Kloots* @module node-menunav
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // Util shortcuts
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // Native types
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // Frequently used strings
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // CSS class names
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots CSS_MENU_HORIZONTAL = getClassName(MENU, "horizontal"),
de413b3e25c9cba63ab4b3003f5a4524d49f9f05Todd Kloots CSS_MENU_LABEL_ACTIVE = getClassName(MENU, LABEL, ACTIVE),
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots CSS_MENU_LABEL_MENUVISIBLE = getClassName(MENU, LABEL, (MENU + "visible")),
de413b3e25c9cba63ab4b3003f5a4524d49f9f05Todd Kloots CSS_MENUITEM_ACTIVE = getClassName(MENUITEM, ACTIVE),
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // CSS selectors
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots// Utility functions
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots// TO DO: Remove once Node implements circular functionality
ce06fcd5562d725b60692d44fd9deef967a3276cTodd Kloots oULs = oParentNode.get(PARENT_NODE).get(CHILDREN);
ce06fcd5562d725b60692d44fd9deef967a3276cTodd Kloots oChildren = oULs.item(oULs.size() - 1).get(CHILDREN);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oPrevious = oChildren.item(oChildren.size() - 1);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots// TO DO: Remove once Node implements circular functionality
ce06fcd5562d725b60692d44fd9deef967a3276cTodd Kloots oULs = oParentNode.get(PARENT_NODE).get(CHILDREN);
ce06fcd5562d725b60692d44fd9deef967a3276cTodd Kloots oChildren = node.get(PARENT_NODE).get(CHILDREN);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Klootsvar setARIAProperty = function (node, property, value) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots bReturnVal = node.get("nodeName").toLowerCase() === LOWERCASE_A;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots return menuLabel.hasClass(CSS_MENU_LABEL_MENUVISIBLE);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots return isAnchor(node) ? node : node.query(LOWERCASE_A);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Klootsvar getNodeWithClass = function (node, className, searchAncestors) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots return getNodeWithClass(node, CSS_MENU, searchAncestors);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Klootsvar getMenuItem = function (node, searchAncestors) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oItem = getNodeWithClass(node, CSS_MENUITEM, searchAncestors);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Klootsvar getMenuLabel = function (node, searchAncestors) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oItem = getNodeWithClass(node, CSS_MENU_LABEL, searchAncestors);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oItem = getNodeWithClass(node, CSS_MENU_LABEL) || node.query((PERIOD + CSS_MENU_LABEL));
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oItem = getMenuItem(node, searchAncestors) || getMenuLabel(node, searchAncestors);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oItemLI = isMenuItem(item) ? item : item.get(PARENT_NODE);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oNextLI = previous ? getPreviousSibling(oItemLI) : getNextSibling(oItemLI);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots return isMenuItem(node) ? CSS_MENUITEM_ACTIVE : CSS_MENU_LABEL_ACTIVE;
ce06fcd5562d725b60692d44fd9deef967a3276cTodd Kloots // TO DO: Remove once implemented in Node
ce06fcd5562d725b60692d44fd9deef967a3276cTodd Kloots // TO DO: Remove once implemented in Node
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Klootsvar handleMouseOverForNode = function (node, target) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots return node && !node[HANDLED_MOUSEOVER] && (node === target || node.contains(target));
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Klootsvar handleMouseOutForNode = function (node, relatedTarget) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots (node !== relatedTarget && !node.contains(relatedTarget));
fab450bda25d83fc914a6413dcd83d3c9919282dTodd Kloots* @namespace Y.plugin
a76888f75bfe3b3fecae528bbe6053e7c1ab353bTodd Kloots* @class NodeMenuNav
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots bAutoSubmenuDisplay = config.autoSubmenuDisplay;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // Enable ARIA for Firefox 3 and IE 8 by default since those are the two browsers
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // that current support ARIA
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots bUseARIA : ((UA.gecko && UA.gecko >= 1.9) || (UA.ie && UA.ie >= 8));
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots Lang.isBoolean(bAutoSubmenuDisplay) ? bAutoSubmenuDisplay : TRUE;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._submenuShowDelay = config.submenuShowDelay || 250;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._submenuHideDelay = config.submenuHideDelay || 250;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._mouseOutHideDelay = Lang.isNumber(nMouseOutHideDelay) ? nMouseOutHideDelay : 750;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // Hide all visible submenus
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oULs = oRootMenu.queryAll("ul:" + FIRST_OF_TYPE);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // Wire up all event handlers
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oRootMenu.on("mouseover", menuNav._onMouseOver, menuNav);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oRootMenu.on("mouseout", menuNav._onMouseOut, menuNav);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oRootMenu.on("mousemove", menuNav._onMouseMove, menuNav);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oRootMenu.on(MOUSEDOWN, menuNav._toggleSubmenuDisplay, menuNav);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oRootMenu.on(KEYDOWN, menuNav._toggleSubmenuDisplay, menuNav);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oRootMenu.on(CLICK, menuNav._toggleSubmenuDisplay, menuNav);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oRootMenu.on("keypress", menuNav._onKeyPress, menuNav);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oRootMenu.on(KEYDOWN, menuNav._onKeyDown, menuNav);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oDocument.on(MOUSEDOWN, menuNav._onDocMouseDown, menuNav);
a76888f75bfe3b3fecae528bbe6053e7c1ab353bTodd Kloots Y.on("focus", Y.bind(menuNav._onDocFocus, menuNav), oDocument);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots placeInDefaultTabIndex(getItemAnchor(oFirstItem));
979600728148238bdf1eee52b1457d1d180c126eTodd Kloots* @property NodeMenuNav.SHIM_TEMPLATE_TITLE
a82da1da5f01d59992c338f04dcbc9dd34002d63Todd Kloots* @description String representing the value for the <code>title</code> attribute for the shim used
a82da1da5f01d59992c338f04dcbc9dd34002d63Todd Kloots* to prevent <code><select></code> elements from poking through menus in IE 6.
a82da1da5f01d59992c338f04dcbc9dd34002d63Todd Kloots* @default "Menu Stacking Shim"
a82da1da5f01d59992c338f04dcbc9dd34002d63Todd Kloots* @type String
a82da1da5f01d59992c338f04dcbc9dd34002d63Todd KlootsMenuNav.SHIM_TEMPLATE_TITLE = "Menu Stacking Shim";
979600728148238bdf1eee52b1457d1d180c126eTodd Kloots* @property NodeMenuNav.SHIM_TEMPLATE
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* @description String representing the HTML used to create the <code><iframe></code> shim
a82da1da5f01d59992c338f04dcbc9dd34002d63Todd Kloots* used to prevent <code><select></code> elements from poking through menus in IE 6.
8a4137ab24ac4a19400c698a65cf8ca511b081c5Todd Kloots* @default "<iframe frameborder="0" tabindex="-1"
8a4137ab24ac4a19400c698a65cf8ca511b081c5Todd Kloots* class="yui-shim" title="Menu Stacking Shim"
8a4137ab24ac4a19400c698a65cf8ca511b081c5Todd Kloots* src="javascript:false;"></iframe>"
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* @type String
8a4137ab24ac4a19400c698a65cf8ca511b081c5Todd Kloots// <iframe> shim notes:
8a4137ab24ac4a19400c698a65cf8ca511b081c5Todd Kloots// 1) Need to set the "frameBorder" property to 0 to suppress the default <iframe> border in IE.
8a4137ab24ac4a19400c698a65cf8ca511b081c5Todd Kloots// (Setting the CSS "border" property alone doesn't suppress it.)
8a4137ab24ac4a19400c698a65cf8ca511b081c5Todd Kloots// 2) The "src" attribute of the <iframe> is set to "javascript:false;" so that it won't load a
8a4137ab24ac4a19400c698a65cf8ca511b081c5Todd Kloots// page inside it, preventing the secure/nonsecure warning in IE when using HTTPS.
8a4137ab24ac4a19400c698a65cf8ca511b081c5Todd Kloots// 3) Since the role of the <iframe> shim is completely presentational, its "tabindex" attribute
8a4137ab24ac4a19400c698a65cf8ca511b081c5Todd Kloots// is set to "-1" and its title attribute is set to "Menu Stacking Shim". Both strategies help
8a4137ab24ac4a19400c698a65cf8ca511b081c5Todd Kloots// users of screen readers to avoid mistakenly interacting with the <iframe> shim.
8a4137ab24ac4a19400c698a65cf8ca511b081c5Todd KlootsMenuNav.SHIM_TEMPLATE = '<iframe frameborder="0" tabindex="-1" class="' +
a82da1da5f01d59992c338f04dcbc9dd34002d63Todd Kloots '" src="javascript:false;"></iframe>';
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // Protected properties
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @property _rootMenu
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description Node instance representing the root menu in the MenuNav.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @default null
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @type Node
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @property _activeItem
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description Node instance representing the MenuNav's active descendent - the menuitem or
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * menu label the user is currently interacting with.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @default null
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @type Node
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @property _activeMenu
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description Node instance representing the menu that is the parent of the MenuNav's
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * active descendent.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @default null
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @type Node
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @property _hasFocus
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description Boolean indicating if the MenuNav has focus.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @default false
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @type Boolean
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // In gecko-based browsers a mouseover and mouseout event will fire even
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // if a DOM element moves out from under the mouse without the user actually
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // moving the mouse. This bug affects MenuNav because the user can hit the
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // Esc key to hide a menu, and if the mouse is over the menu when the
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // user presses Esc, the _onMenuMouseOut handler will be called. To fix this
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // bug the following flag (_blockMouseEvent) is used to block the code in the
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // _onMenuMouseOut handler from executing.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @property _blockMouseEvent
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description Boolean indicating whether or not to handle the "mouseover" event.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @default false
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @type Boolean
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @property _currentMouseX
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description Number representing the current x coordinate of the mouse inside the MenuNav.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @default 0
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @type Number
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @property _movingToSubmenu
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description Boolean indicating if the mouse is moving from a menu label to its
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * corresponding submenu.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @default false
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @type Boolean
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @property _showSubmenuTimer
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description Timer used to show a submenu.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @default null
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @type Object
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @property _hideSubmenuTimer
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description Timer used to hide a submenu.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @default null
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @type Object
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @property _hideAllSubmenusTimer
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description Timer used to hide a all submenus.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @default null
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @type Object
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @property _firstItem
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description Node instance representing the first item (menuitem or menu label) in the root
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * menu of a MenuNav.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @default null
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @type Node
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @property _autoSubmenuDisplay
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description Boolean indicating if submenus are automatically made visible when the user
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * mouses over the menu's items.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @default true
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @type Boolean
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // Protected methods
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @method _isRoot
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description Returns a boolean indicating if the specified menu is the root menu in
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * the MenuNav.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @param {Node} menu Node instance representing a menu.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @return {Boolean} Boolean indicating if the specified menu is the root menu in the MenuNav.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @method _getTopmostSubmenu
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description Returns the topmost submenu of a submenu hierarchy.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @param {Node} menu Node instance representing a menu.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @return {Node} Node instance representing a menu.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @method _clearActiveItem
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description Clears the MenuNav's active descendent.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oActiveItem.removeClass(getActiveClass(oActiveItem));
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @method _setActiveItem
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description Sets the specified menuitem or menu label as the MenuNav's active descendent.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @param {Node} item Node instance representing a menuitem or menu label.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @method _focusItem
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description Focuses the specified menuitem or menu label.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @param {Node} item Node instance representing a menuitem or menu label.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // Need to focus using a zero-second timeout to get Apple's VoiceOver to
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // recognize that the focused item has changed
ce06fcd5562d725b60692d44fd9deef967a3276cTodd Kloots * @method _applyARIA
ce06fcd5562d725b60692d44fd9deef967a3276cTodd Kloots * @description Applies the ARIA Roles, States and Properties to the supplied menu.
ce06fcd5562d725b60692d44fd9deef967a3276cTodd Kloots * @protected
ce06fcd5562d725b60692d44fd9deef967a3276cTodd Kloots * @param {Node} menu Node instance representing a menu.
ce06fcd5562d725b60692d44fd9deef967a3276cTodd Kloots setARIARole(menu, (bIsRoot ? "menubar" : MENU));
ce06fcd5562d725b60692d44fd9deef967a3276cTodd Kloots oMenuToggle = oMenuLabel.query(PERIOD + getClassName(MENU, "toggle"));
ce06fcd5562d725b60692d44fd9deef967a3276cTodd Kloots oMenuItemContentNodes = menu.queryAll((PERIOD + getClassName(MENUITEM, "content")));
ce06fcd5562d725b60692d44fd9deef967a3276cTodd Kloots oMenuLabelNodes = menu.queryAll((PERIOD + CSS_MENU_LABEL));
ce06fcd5562d725b60692d44fd9deef967a3276cTodd Kloots oMenuToggle = node.query((PERIOD + getClassName(MENU, "toggle")));
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @method _showMenu
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description Shows the specified menu.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @param {Node} menu Node instance representing a menu.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menu.appendChild(Y.Node.create(MenuNav.SHIM_TEMPLATE));
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // Clear previous values for height and width
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menu.setStyles({ height: EMPTY_STRING, width: EMPTY_STRING });
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // Set the width and height of the menu's bounding box - this is necessary for IE 6
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // so that the CSS for the <iframe> shim can simply set the <iframe>'s width and height
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // to 100% to ensure that dimensions of an <iframe> shim are always sync'd to the
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // that of its parent menu. Specifying a width and height also helps when positioning
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // decorator elements (for creating effects like rounded corners) inside a menu's
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // bounding box in IE 7.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menu.previous().addClass(CSS_MENU_LABEL_MENUVISIBLE);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @method _hideMenu
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description Hides the specified menu.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @param {Node} menu Node instance representing a menu.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @param {Boolean} activateAndFocusLabel Boolean indicating if the label for the specified
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * menu should be focused and set as active.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots _hideMenu: function (menu, activateAndFocusLabel) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oActiveItem = menu.query((PERIOD + CSS_MENUITEM_ACTIVE));
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // Clear the values for top and left that were set by the call to "setXY" when the menu
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // was shown so that the hidden position specified in the core CSS file will take affect.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menu.setStyles({ left: EMPTY_STRING, top: EMPTY_STRING });
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @method _hideAllSubmenus
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description Hides all submenus of the specified menu.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @param {Node} menu Node instance representing a menu.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @method _cancelShowSubmenuTimer
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description Cancels the timer used to show a submenu.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @method _cancelHideSubmenuTimer
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description Cancels the timer used to hide a submenu.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // Event handlers for discrete pieces of pieces of the menu
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @method _onMenuMouseOver
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description "mouseover" event handler for a menu.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @param {Node} menu Node instance representing a menu.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @param {Object} event Object representing the DOM event.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oHideAllSubmenusTimer = menuNav._hideAllSubmenusTimer;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (menuNav._movingToSubmenu && isHorizontalMenu(menu)) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @method _onMenuMouseOut
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description "mouseout" event handler for a menu.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @param {Node} menu Node instance representing a menu.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @param {Object} event Object representing the DOM event.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (oActiveMenu && !oActiveMenu.contains(oRelatedTarget)) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (oParentMenu && !oParentMenu.contains(oRelatedTarget)) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots later(menuNav._mouseOutHideDelay, menuNav, function () {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // Focus the label element for the topmost submenu
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oSubmenu = menuNav._getTopmostSubmenu(oActiveMenu);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @method _onMenuLabelMouseOver
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description "mouseover" event handler for a menu label.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @param {Node} menuLabel Node instance representing a menu label.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @param {Object} event Object representing the DOM event.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots _onMenuLabelMouseOver: function (menuLabel, event) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots bUseAutoSubmenuDisplay = (menuNav._autoSubmenuDisplay && bIsRoot || !bIsRoot),
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (bUseAutoSubmenuDisplay && !menuNav._movingToSubmenu) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @method _onMenuLabelMouseOut
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description "mouseout" event handler for a menu label.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @param {Node} menuLabel Node instance representing a menu label.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @param {Object} event Object representing the DOM event.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots _onMenuLabelMouseOut: function (menuLabel, event) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots bUseAutoSubmenuDisplay = (menuNav._autoSubmenuDisplay && bIsRoot || !bIsRoot),
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (menuNav._movingToSubmenu && !menuNav._showSubmenuTimer && oSubmenu) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // If the mouse is moving diagonally toward the submenu and another submenu
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // isn't in the process of being displayed (via a timer), then hide the submenu
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // via a timer to give the user some time to reach the submenu.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menuNav._hideSubmenuTimer = later(menuNav._submenuHideDelay, menuNav,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots else if (!menuNav._movingToSubmenu && oSubmenu &&
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots !oSubmenu.contains(oRelatedTarget) && oRelatedTarget !== oSubmenu) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // If the mouse is not moving toward the submenu, cancel any submenus that
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // might be in the process of being displayed (via a timer) and hide this
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // submenu immediately.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @method _onMenuItemMouseOver
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description "mouseover" event handler for a menuitem.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @param {Node} menuItem Node instance representing a menuitem.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @param {Object} event Object representing the DOM event.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots _onMenuItemMouseOver: function (menuItem, event) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots bUseAutoSubmenuDisplay = (menuNav._autoSubmenuDisplay && bIsRoot || !bIsRoot);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (bUseAutoSubmenuDisplay && !menuNav._movingToSubmenu) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @method _onMenuItemMouseOut
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description "mouseout" event handler for a menuitem.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @param {Node} menuItem Node instance representing a menuitem.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @param {Object} event Object representing the DOM event.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots _onMenuItemMouseOut: function (menuItem, event) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @method _onVerticalMenuKeyDown
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description "keydown" event handler for vertical menus of a MenuNav.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @param {Object} event Object representing the DOM event.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (oParentMenu && isHorizontalMenu(oParentMenu)) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oLI = getPreviousSibling(oActiveMenu.get(PARENT_NODE));
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots else { // MenuItem
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oSubmenu = menuNav._getTopmostSubmenu(oActiveMenu);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oLI = getNextSibling(oSubmenu.get(PARENT_NODE));
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots else { // MenuItem
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots getPreviousItem(oFocusedItem) : getNextItem(oFocusedItem);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // Prevent the browser from scrolling the window
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @method _onHorizontalMenuKeyDown
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description "keydown" event handler for horizontal menus of a MenuNav.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @param {Object} event Object representing the DOM event.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots getPreviousItem(oFocusedItem) : getNextItem(oFocusedItem);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // Prevent the browser from scrolling the window
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // Generic DOM Event handlers
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @method _onMouseMove
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description "mousemove" event handler for the MenuNav.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @param {Object} event Object representing the DOM event.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // Using a timer to set the value of the "_currentMouseX" property helps improve the
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // reliability of the calculation used to set the value of the "_movingToSubmenu"
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // property - especially in Opera.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @method _onMouseOver
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description "mouseover" event handler for the MenuNav.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @param {Object} event Object representing the DOM event.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (handleMouseOverForNode(oMenuLabel, oTarget)) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._onMenuLabelMouseOver(oMenuLabel, event);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (handleMouseOverForNode(oMenuItem, oTarget)) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @method _onMouseOut
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description "mouseout" event handler for the MenuNav.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @param {Object} event Object representing the DOM event.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menuNav._movingToSubmenu = (oActiveMenu && !isHorizontalMenu(oActiveMenu) &&
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (handleMouseOutForNode(oMenuLabel, oRelatedTarget)) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._onMenuLabelMouseOut(oMenuLabel, event);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (handleMouseOutForNode(oMenuItem, oRelatedTarget)) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (oSubmenu && (oRelatedTarget === oSubmenu || oSubmenu.contains(oRelatedTarget))) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (handleMouseOutForNode(oMenu, oRelatedTarget) || bMovingToSubmenu) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @method _toggleSubmenuDisplay
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description "mousedown," "keydown," and "click" event handler for the MenuNav used to
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * toggle the display of a submenu.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @param {Object} event Object representing the DOM event.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oAnchor = isAnchor(oTarget) ? oTarget : oTarget.ancestor(isAnchor);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // Need to pass "2" as a second argument to "getAttribute" for IE otherwise IE
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // will return a fully qualified URL for the value of the "href" attribute.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // http://msdn.microsoft.com/en-us/library/ms536429(VS.85).aspx
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (sType === MOUSEDOWN || (sType === KEYDOWN && event.keyCode === 13)) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // The call to "preventDefault" below results in the element
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // serving as the menu's label to not receive focus in Webkit,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // therefore the "_hasFocus" flag never gets set to true, meaning the
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // first item in the submenu isn't focused when the submenu is
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // displayed. To fix this issue, it is necessary to set the
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // "_hasFocus" flag to true.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // Prevent the browser from following the URL of the anchor element
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @method _onKeyPress
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description "keypress" event handler for the MenuNav.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @param {Object} event Object representing the DOM event.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // Prevent the browser from scrolling the window
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @method _onKeyDown
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description "keydown" event handler for the MenuNav.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @param {Object} event Object representing the DOM event.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._blockMouseEvent = UA.gecko ? TRUE : FALSE;
ce06fcd5562d725b60692d44fd9deef967a3276cTodd Kloots if (isMenuLabel(oActiveItem) && hasVisibleSubmenu(oActiveItem)) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @method _onDocMouseDown
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description "mousedown" event handler for the owner document of the MenuNav.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @param {Object} event Object representing the DOM event.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (!oRoot.compareTo(oTarget) && !oRoot.contains(oTarget)) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // Document doesn't receive focus in Webkit when the user mouses down on it,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // so the "_hasFocus" property won't get set to the correct value. The
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // following line corrects the problem.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @method _onDocFocus
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description "focus" event handler for the owner document of the MenuNav.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @param {Object} event Object representing the DOM event.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (menuNav._rootMenu.contains(oTarget)) { // The menu has focus
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // First time the menu has been focused, need to setup focused state and
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // established active active descendant
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots else { // The menu has lost focus
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots placeInDefaultTabIndex(getItemAnchor(oFirstItem));
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots}, '@VERSION@' ,{requires:['node', 'classnamemanager']});