node-menunav-debug.js revision a82da1da5f01d59992c338f04dcbc9dd34002d63
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, while only requiring
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>
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* oMenuNav.plug(Y.Plugin.NodeMenuNav);
14b1e9d6653e5b6ec6b2fbd4e30faaf3a74b6cf7Todd Kloots* <p>The MenuNav Node Plugin has several configuration properties that can be set via an
14b1e9d6653e5b6ec6b2fbd4e30faaf3a74b6cf7Todd 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>
14b1e9d6653e5b6ec6b2fbd4e30faaf3a74b6cf7Todd Kloots* oMenuNav.plug(Y.Plugin.NodeMenuNav, { autoSubmenuDisplay: true });
fab450bda25d83fc914a6413dcd83d3c9919282dTodd Kloots* <p> The complete list of The MenuNav Node Plugin configuration properties are:</p>
14b1e9d6653e5b6ec6b2fbd4e30faaf3a74b6cf7Todd Kloots* <dt>useARIA</dt>
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* <dd>Boolean indicating if use of the WAI-ARIA Roles and States should be enabled for the
5704a55c960a1cb578bb2a13dc757d31b8b45a11Todd 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>
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* @module nodemenunav
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // Util shortcuts
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // Native types
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // Frequently used strings
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // CSS class names
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots CSS_MENU_HORIZONTAL = getClassName(MENU, "horizontal"),
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots CSS_MENU_LABEL_ACTIVE = getClassName(MENU, LABEL, ACTIVE),
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots CSS_MENU_LABEL_MENUVISIBLE = getClassName(MENU, LABEL, (MENU + "visible")),
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots CSS_MENUITEM_ACTIVE = getClassName(MENUITEM, ACTIVE),
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // CSS selectors
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots// Utility functions
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots// TO DO: Remove once Node implements circular functionality
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oChildren = node.get(PARENT_NODE).get(CHILDREN);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oPrevious = oChildren.item(oChildren.size() - 1);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots// TO DO: Remove once Node implements circular functionality
5f40f927dba3cf399373572f6ed6fe59a376376eTodd 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);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Klootsvar getNodeWithClass = function (node, className, searchAncestors) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots return getNodeWithClass(node, CSS_MENU, searchAncestors);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Klootsvar getMenuItem = function (node, searchAncestors) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd 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));
5f40f927dba3cf399373572f6ed6fe59a376376eTodd 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);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots return isMenuItem(node) ? CSS_MENUITEM_ACTIVE : CSS_MENU_LABEL_ACTIVE;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // TO DO: Remove once implemented in Node
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd 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));
de413b3e25c9cba63ab4b3003f5a4524d49f9f05Todd Kloots* @namespace Y.Plugin
de413b3e25c9cba63ab4b3003f5a4524d49f9f05Todd Kloots* @class NodeMenuNav
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots bAutoSubmenuDisplay = config.autoSubmenuDisplay;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // Enable ARIA for Firefox 3 and IE 8 by default since those are the two browsers
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // that current support ARIA
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots bUseARIA : ((UA.gecko && UA.gecko >= 1.9) || (UA.ie && UA.ie >= 8));
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots Lang.isBoolean(bAutoSubmenuDisplay) ? bAutoSubmenuDisplay : TRUE;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._submenuShowDelay = config.submenuShowDelay || 250;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menuNav._submenuHideDelay = config.submenuHideDelay || 250;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._mouseOutHideDelay = Lang.isNumber(nMouseOutHideDelay) ? nMouseOutHideDelay : 750;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // Hide all visible submenus
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oULs = oRootMenu.queryAll("ul:" + FIRST_OF_TYPE);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // Wire up all event handlers
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oRootMenu.on("mouseover", menuNav._onMouseOver, menuNav);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oRootMenu.on("mouseout", menuNav._onMouseOut, menuNav);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd 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);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots Y.on("focus", Y.bind(menuNav._onDocFocus, menuNav), oDocument);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oMenuItemContentNodes = oRootMenu.queryAll((PERIOD + getClassName(MENUITEM, "content")));
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oMenuLabelNodes = oRootMenu.queryAll((PERIOD + CSS_MENU_LABEL));
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oMenuToggle = node.query((PERIOD + getClassName(MENU, "toggle")));
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots placeInDefaultTabIndex(getItemAnchor(oFirstItem));
de413b3e25c9cba63ab4b3003f5a4524d49f9f05Todd Kloots* @property NodeMenuNav.SHIM_TEMPLATE_TITLE
de413b3e25c9cba63ab4b3003f5a4524d49f9f05Todd 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.
979600728148238bdf1eee52b1457d1d180c126eTodd Kloots* @default "Menu Stacking Shim"
a82da1da5f01d59992c338f04dcbc9dd34002d63Todd Kloots* @type String
a82da1da5f01d59992c338f04dcbc9dd34002d63Todd KlootsMenuNav.SHIM_TEMPLATE_TITLE = "Menu Stacking Shim";
a82da1da5f01d59992c338f04dcbc9dd34002d63Todd Kloots* @property NodeMenuNav.SHIM_TEMPLATE
a82da1da5f01d59992c338f04dcbc9dd34002d63Todd Kloots* @description String representing the HTML used to create the <code><iframe></code> shim
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* used to prevent <code><select></code> elements from poking through menus in IE 6.
979600728148238bdf1eee52b1457d1d180c126eTodd Kloots* @default '<iframe frameborder="0" role="presentation" class="yui-shim" title="Menu Stacking Shim" src="javascript:false;"></iframe>'
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* @type String
8a4137ab24ac4a19400c698a65cf8ca511b081c5Todd Kloots// Need to set the "frameBorder" property to 0 to suppress the default <iframe>
8a4137ab24ac4a19400c698a65cf8ca511b081c5Todd Kloots// border in IE. Setting the CSS "border" property alone doesn't suppress it.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd KlootsMenuNav.SHIM_TEMPLATE = '<iframe frameborder="0" role="presentation" class="' +
8a4137ab24ac4a19400c698a65cf8ca511b081c5Todd Kloots '" src="javascript:false;"></iframe>';
8a4137ab24ac4a19400c698a65cf8ca511b081c5Todd Kloots // Protected properties
8a4137ab24ac4a19400c698a65cf8ca511b081c5Todd Kloots * @property _rootMenu
8a4137ab24ac4a19400c698a65cf8ca511b081c5Todd Kloots * @description Node instance representing the root menu in the MenuNav.
8a4137ab24ac4a19400c698a65cf8ca511b081c5Todd Kloots * @default null
8a4137ab24ac4a19400c698a65cf8ca511b081c5Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @type Node
5f40f927dba3cf399373572f6ed6fe59a376376eTodd 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
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @property _hasFocus
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @description Boolean indicating if the MenuNav has focus.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @default false
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @type Boolean
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // In gecko-based browsers a mouseover and mouseout event will fire even
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd 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.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @default false
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @protected
5f40f927dba3cf399373572f6ed6fe59a376376eTodd 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
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @property _movingToSubmenu
5f40f927dba3cf399373572f6ed6fe59a376376eTodd 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
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @property _showSubmenuTimer
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description Timer used to show a submenu.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @default null
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @type Object
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @property _hideSubmenuTimer
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @description Timer used to hide a submenu.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @default null
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @type Object
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @property _hideAllSubmenusTimer
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @description Timer used to hide a all submenus.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @default null
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @type Object
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @property _firstItem
5f40f927dba3cf399373572f6ed6fe59a376376eTodd 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
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @property _autoSubmenuDisplay
5f40f927dba3cf399373572f6ed6fe59a376376eTodd 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.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @method _clearActiveItem
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @description Clears the MenuNav's active descendent.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @protected
5f40f927dba3cf399373572f6ed6fe59a376376eTodd 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
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @description Focuses the specified menuitem or menu label.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @param {Node} item Node instance representing a menuitem or menu label.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // Need to focus using a zero-second timeout to get Apple's VoiceOver to
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // recognize that the focused item has changed
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @method _showMenu
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description Shows the specified menu.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @param {Node} menu Node instance representing a menu.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd 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 });
5f40f927dba3cf399373572f6ed6fe59a376376eTodd 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
fab450bda25d83fc914a6413dcd83d3c9919282dTodd 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);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @method _hideMenu
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @description Hides the specified menu.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @protected
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @param {Node} menu Node instance representing a menu.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @param {Boolean} activateAndFocusLabel Boolean indicating if the label for the specified
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * menu should be focused and set as active.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots _hideMenu: function (menu, activateAndFocusLabel) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oActiveItem = menu.query((PERIOD + CSS_MENUITEM_ACTIVE));
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // Clear the values for top and left that were set by the call to "setXY" when the menu
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // was shown so that the hidden position specified in the core CSS file will take affect.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menu.setStyles({ left: EMPTY_STRING, top: EMPTY_STRING });
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @method _hideAllSubmenus
5f40f927dba3cf399373572f6ed6fe59a376376eTodd 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
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @method _cancelHideSubmenuTimer
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @description Cancels the timer used to hide a submenu.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @protected
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // Event handlers for discrete pieces of pieces of the menu
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @method _onMenuMouseOver
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @description "mouseover" event handler for a menu.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @protected
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @param {Node} menu Node instance representing a menu.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @param {Object} event Object representing the DOM event.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oHideAllSubmenusTimer = menuNav._hideAllSubmenusTimer;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (menuNav._movingToSubmenu && isHorizontalMenu(menu)) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @method _onMenuMouseOut
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @description "mouseout" event handler for a menu.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @protected
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @param {Node} menu Node instance representing a menu.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @param {Object} event Object representing the DOM event.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (oActiveMenu && !oActiveMenu.contains(oRelatedTarget)) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (oParentMenu && !oParentMenu.contains(oRelatedTarget)) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots later(menuNav._mouseOutHideDelay, menuNav, function () {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // Focus the label element for the topmost submenu
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oSubmenu = menuNav._getTopmostSubmenu(oActiveMenu);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @method _onMenuLabelMouseOver
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @description "mouseover" event handler for a menu label.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @protected
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @param {Node} menuLabel Node instance representing a menu label.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @param {Object} event Object representing the DOM event.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots _onMenuLabelMouseOver: function (menuLabel, event) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots bUseAutoSubmenuDisplay = (menuNav._autoSubmenuDisplay && bIsRoot || !bIsRoot),
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (bUseAutoSubmenuDisplay && !menuNav._movingToSubmenu) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @method _onMenuLabelMouseOut
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description "mouseout" event handler for a menu label.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @protected
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @param {Node} menuLabel Node instance representing a menu label.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @param {Object} event Object representing the DOM event.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots _onMenuLabelMouseOut: function (menuLabel, event) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots bUseAutoSubmenuDisplay = (menuNav._autoSubmenuDisplay && bIsRoot || !bIsRoot),
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (menuNav._movingToSubmenu && !menuNav._showSubmenuTimer && oSubmenu) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // If the mouse is moving diagonally toward the submenu and another submenu
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // isn't in the process of being displayed (via a timer), then hide the submenu
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // via a timer to give the user some time to reach the submenu.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._hideSubmenuTimer = later(menuNav._submenuHideDelay, menuNav,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots else if (!menuNav._movingToSubmenu && oSubmenu &&
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots !oSubmenu.contains(oRelatedTarget) && oRelatedTarget !== oSubmenu) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // If the mouse is not moving toward the submenu, cancel any submenus that
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // might be in the process of being displayed (via a timer) and hide this
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // submenu immediately.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @method _onMenuItemMouseOver
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @description "mouseover" event handler for a menuitem.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @protected
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @param {Node} menuItem Node instance representing a menuitem.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @param {Object} event Object representing the DOM event.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots _onMenuItemMouseOver: function (menuItem, event) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots bUseAutoSubmenuDisplay = (menuNav._autoSubmenuDisplay && bIsRoot || !bIsRoot);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (bUseAutoSubmenuDisplay && !menuNav._movingToSubmenu) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @method _onMenuItemMouseOut
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @description "mouseout" event handler for a menuitem.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @protected
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @param {Node} menuItem Node instance representing a menuitem.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd 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));
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots else { // MenuItem
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oSubmenu = menuNav._getTopmostSubmenu(oActiveMenu);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oLI = getNextSibling(oSubmenu.get(PARENT_NODE));
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots else { // MenuItem
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots getPreviousItem(oFocusedItem) : getNextItem(oFocusedItem);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // Prevent the browser from scrolling the window
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @method _onHorizontalMenuKeyDown
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @description "keydown" event handler for horizontal menus of a MenuNav.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @protected
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @param {Object} event Object representing the DOM event.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots getPreviousItem(oFocusedItem) : getNextItem(oFocusedItem);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // Prevent the browser from scrolling the window
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // Generic DOM Event handlers
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @method _onMouseMove
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description "mousemove" event handler for the MenuNav.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @protected
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @param {Object} event Object representing the DOM event.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd 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)) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @method _onMouseOut
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @description "mouseout" event handler for the MenuNav.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @protected
5f40f927dba3cf399373572f6ed6fe59a376376eTodd 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);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (handleMouseOutForNode(oMenuItem, oRelatedTarget)) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (oSubmenu && (oRelatedTarget === oSubmenu || oSubmenu.contains(oRelatedTarget))) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (handleMouseOutForNode(oMenu, oRelatedTarget) || bMovingToSubmenu) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @method _toggleSubmenuDisplay
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @description "mousedown," "keydown," and "click" event handler for the MenuNav used to
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * toggle the display of a submenu.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @protected
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @param {Object} event Object representing the DOM event.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd 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
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // serving as the menu's label to not receive focus in Webkit,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // therefore the "_hasFocus" flag never gets set to true, meaning the
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // first item in the submenu isn't focused when the submenu is
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // displayed. To fix this issue, it is necessary to set the
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // "_hasFocus" flag to true.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // Prevent the browser from following the URL of the anchor element
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @method _onKeyPress
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @description "keypress" event handler for the MenuNav.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @protected
5f40f927dba3cf399373572f6ed6fe59a376376eTodd 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
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @param {Object} event Object representing the DOM event.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menuNav._blockMouseEvent = UA.gecko ? TRUE : FALSE;
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)) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd 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
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // following line corrects the problem.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @method _onDocFocus
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description "focus" event handler for the owner document of the MenuNav.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @protected
5f40f927dba3cf399373572f6ed6fe59a376376eTodd 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
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // established active active descendant
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots else { // The menu has lost focus
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots placeInDefaultTabIndex(getItemAnchor(oFirstItem));
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots}, '@VERSION@' ,{requires:['node', 'classnamemanager']});