node-menunav-debug.js revision a82da1da5f01d59992c338f04dcbc9dd34002d63
5f40f927dba3cf399373572f6ed6fe59a376376eTodd KlootsYUI.add('node-menunav', function(Y) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots/**
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*
14b1e9d6653e5b6ec6b2fbd4e30faaf3a74b6cf7Todd Kloots* <code>
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* var oMenuNav = Y.Node.get("#productsandservices");<br>
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* oMenuNav.plug(Y.Plugin.NodeMenuNav);
fab450bda25d83fc914a6413dcd83d3c9919282dTodd Kloots* </code>
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots*
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* </p>
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots*
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* <code>
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* var oMenuNav = Y.Node.get("#productsandservices");<br>
14b1e9d6653e5b6ec6b2fbd4e30faaf3a74b6cf7Todd Kloots* oMenuNav.plug(Y.Plugin.NodeMenuNav, { autoSubmenuDisplay: true });
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* </code>
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots*
fab450bda25d83fc914a6413dcd83d3c9919282dTodd Kloots* <p> The complete list of The MenuNav Node Plugin configuration properties are:</p>
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* <dl>
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*
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*
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*
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*
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* </dl>
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots*
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* @module nodemenunav
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots*/
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // Util shortcuts
8a4137ab24ac4a19400c698a65cf8ca511b081c5Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Klootsvar UA = Y.UA,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots Lang = Y.Lang,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots later = Y.later,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots getClassName = Y.ClassNameManager.getClassName,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // Native types
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots TRUE = true,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots FALSE = false,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots NULL = null,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // Frequently used strings
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots MENU = "menu",
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots MENUITEM = "menuitem",
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots HIDDEN = "hidden",
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots TAB_INDEX = "tabIndex",
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots PARENT_NODE = "parentNode",
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots CHILDREN = "children",
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots OFFSET_HEIGHT = "offsetHeight",
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots OFFSET_WIDTH = "offsetWidth",
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots PX = "px",
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots ID = "id",
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots PERIOD = ".",
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots HANDLED_MOUSEOUT = "handledMouseOut",
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots HANDLED_MOUSEOVER = "handledMouseOver",
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots ACTIVE = "active",
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots LABEL = "label",
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots LOWERCASE_A = "a",
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots MOUSEDOWN = "mousedown",
de413b3e25c9cba63ab4b3003f5a4524d49f9f05Todd Kloots KEYDOWN = "keydown",
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots CLICK = "click",
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots EMPTY_STRING = "",
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots FIRST_OF_TYPE = "first-of-type",
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // CSS class names
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots CSS_MENU = getClassName(MENU),
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots CSS_MENU_HIDDEN = getClassName(MENU, HIDDEN),
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots CSS_MENU_HORIZONTAL = getClassName(MENU, "horizontal"),
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots CSS_MENU_LABEL = getClassName(MENU, LABEL),
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 = getClassName(MENUITEM),
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots CSS_MENUITEM_ACTIVE = getClassName(MENUITEM, ACTIVE),
de413b3e25c9cba63ab4b3003f5a4524d49f9f05Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // CSS selectors
de413b3e25c9cba63ab4b3003f5a4524d49f9f05Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots MENU_SELECTOR = PERIOD + CSS_MENU;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots// Utility functions
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots// TO DO: Remove once Node implements circular functionality
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Klootsvar getPreviousSibling = function (node) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots var oPrevious = node.previous(),
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oChildren;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (!oPrevious) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oChildren = node.get(PARENT_NODE).get(CHILDREN);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oPrevious = oChildren.item(oChildren.size() - 1);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots return oPrevious;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots};
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots// TO DO: Remove once Node implements circular functionality
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Klootsvar getNextSibling = function (node) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots var oNext = node.next(),
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oChildren;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (!oNext) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oChildren = node.get(PARENT_NODE).get(CHILDREN);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oNext = oChildren.item(0);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots return oNext;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots};
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Klootsvar setARIARole = function (node, role) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots node.setAttribute("role", role);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots};
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Klootsvar setARIAProperty = function (node, property, value) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots node.setAttribute(("aria-" + property), value);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots};
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Klootsvar setARIAPresentation = function (node) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots setARIARole(node, "presentation");
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots};
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Klootsvar removeFromTabIndex = function (node) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots node.set(TAB_INDEX, -1);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots};
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Klootsvar placeInDefaultTabIndex = function (node) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots node.set(TAB_INDEX, 0);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots};
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Klootsvar isAnchor = function (node) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots var bReturnVal = FALSE;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (node) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots bReturnVal = node.get("nodeName").toLowerCase() === LOWERCASE_A;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots return bReturnVal;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots};
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Klootsvar isMenuItem = function (node) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots return node.hasClass(CSS_MENUITEM);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots};
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Klootsvar isMenuLabel = function (node) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots return node.hasClass(CSS_MENU_LABEL);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots};
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Klootsvar isHorizontalMenu = function (menu) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots return menu.hasClass(CSS_MENU_HORIZONTAL);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots};
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Klootsvar hasVisibleSubmenu = function (menuLabel) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots return menuLabel.hasClass(CSS_MENU_LABEL_MENUVISIBLE);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots};
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Klootsvar getItemAnchor = function (node) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots return isAnchor(node) ? node : node.query(LOWERCASE_A);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots};
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Klootsvar getNodeWithClass = function (node, className, searchAncestors) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots var oItem;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (node) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (node.hasClass(className)) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oItem = node;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (!oItem && searchAncestors) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oItem = node.ancestor((PERIOD + className));
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots return oItem;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots};
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Klootsvar getParentMenu = function (node) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots return node.ancestor(MENU_SELECTOR);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots};
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Klootsvar getMenu = function (node, searchAncestors) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots return getNodeWithClass(node, CSS_MENU, searchAncestors);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots};
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Klootsvar getMenuItem = function (node, searchAncestors) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots var oItem;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (node) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oItem = getNodeWithClass(node, CSS_MENUITEM, searchAncestors);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots return oItem;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots};
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Klootsvar getMenuLabel = function (node, searchAncestors) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots var oItem;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (node) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (searchAncestors) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oItem = getNodeWithClass(node, CSS_MENU_LABEL, searchAncestors);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots else {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oItem = getNodeWithClass(node, CSS_MENU_LABEL) || node.query((PERIOD + CSS_MENU_LABEL));
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots return oItem;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots};
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Klootsvar getItem = function (node, searchAncestors) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots var oItem;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (node) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oItem = getMenuItem(node, searchAncestors) || getMenuLabel(node, searchAncestors);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots return oItem;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots};
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Klootsvar getNextItem = function (item, previous) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots var oItemLI,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oNextLI,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oNextItem;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (item) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oItemLI = isMenuItem(item) ? item : item.get(PARENT_NODE);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oNextLI = previous ? getPreviousSibling(oItemLI) : getNextSibling(oItemLI);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oNextItem = getItem(oNextLI);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots return oNextItem;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots};
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Klootsvar getPreviousItem = function (item) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots return getNextItem(item, true);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots};
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Klootsvar getFirstItem = function (menu) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots return getItem(menu.query("li"));
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots};
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Klootsvar getActiveClass = function (node) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots return isMenuItem(node) ? CSS_MENUITEM_ACTIVE : CSS_MENU_LABEL_ACTIVE;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
de413b3e25c9cba63ab4b3003f5a4524d49f9f05Todd Kloots};
de413b3e25c9cba63ab4b3003f5a4524d49f9f05Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Klootsvar blurItem = function (item) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots var oAnchor = getItemAnchor(item);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // TO DO: Remove once implemented in Node
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots try {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oAnchor.blur();
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots catch (ex) { }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots};
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Klootsvar focusItem = function (item) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots var oAnchor = getItemAnchor(item);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // TO DO: Remove once implemented in Node
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots try {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oAnchor.focus();
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots catch (ex) { }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots};
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Klootsvar handleMouseOverForNode = function (node, target) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots return node && !node[HANDLED_MOUSEOVER] && (node === target || node.contains(target));
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots};
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Klootsvar handleMouseOutForNode = function (node, relatedTarget) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots return node && !node[HANDLED_MOUSEOUT] &&
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots (node !== relatedTarget && !node.contains(relatedTarget));
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots};
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
de413b3e25c9cba63ab4b3003f5a4524d49f9f05Todd Kloots/*
de413b3e25c9cba63ab4b3003f5a4524d49f9f05Todd Kloots* @namespace Y.Plugin
de413b3e25c9cba63ab4b3003f5a4524d49f9f05Todd Kloots* @class NodeMenuNav
de413b3e25c9cba63ab4b3003f5a4524d49f9f05Todd Kloots*/
d52939b26ae6dd79b98efda6161c0d3a94f574d7Todd Klootsvar MenuNav = function (config) {
fab450bda25d83fc914a6413dcd83d3c9919282dTodd Kloots
a76888f75bfe3b3fecae528bbe6053e7c1ab353bTodd Kloots var menuNav = this,
a76888f75bfe3b3fecae528bbe6053e7c1ab353bTodd Kloots oRootMenu = config.owner,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oDocument,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oSubmenu,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots sID,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots bUseARIA,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots bAutoSubmenuDisplay,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots nMouseOutHideDelay,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oMenuLabel,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oMenuToggle,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oListNodes,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oMenuNodes,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oMenuItemContentNodes,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oMenuLabelNodes,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oFirstItem,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oULs;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (oRootMenu) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots bUseARIA = config.useARIA;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots bAutoSubmenuDisplay = config.autoSubmenuDisplay;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots nMouseOutHideDelay = config.mouseOutHideDelay;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // Enable ARIA for Firefox 3 and IE 8 by default since those are the two browsers
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // that current support ARIA
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._useARIA = Lang.isBoolean(bUseARIA) ?
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots bUseARIA : ((UA.gecko && UA.gecko >= 1.9) || (UA.ie && UA.ie >= 8));
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._autoSubmenuDisplay =
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots Lang.isBoolean(bAutoSubmenuDisplay) ? bAutoSubmenuDisplay : TRUE;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._submenuShowDelay = config.submenuShowDelay || 250;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menuNav._submenuHideDelay = config.submenuHideDelay || 250;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._mouseOutHideDelay = Lang.isNumber(nMouseOutHideDelay) ? nMouseOutHideDelay : 750;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // Hide all visible submenus
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oMenuNodes = oRootMenu.queryAll(MENU_SELECTOR);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (oMenuNodes) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oMenuNodes.addClass(CSS_MENU_HIDDEN);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oULs = oRootMenu.queryAll("ul:" + FIRST_OF_TYPE);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (oULs) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oULs.addClass(FIRST_OF_TYPE);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // Wire up all event handlers
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
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
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oDocument = oRootMenu.get("ownerDocument");
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oDocument.on(MOUSEDOWN, menuNav._onDocMouseDown, menuNav);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots Y.on("focus", Y.bind(menuNav._onDocFocus, menuNav), oDocument);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menuNav._rootMenu = oRootMenu;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
a76888f75bfe3b3fecae528bbe6053e7c1ab353bTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (menuNav._useARIA) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots setARIARole(oRootMenu, "menubar");
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oListNodes = oRootMenu.queryAll("ul,li");
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (oListNodes) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oListNodes.each(function (node) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots setARIAPresentation(node);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots });
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oMenuItemContentNodes = oRootMenu.queryAll((PERIOD + getClassName(MENUITEM, "content")));
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (oMenuItemContentNodes) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oMenuItemContentNodes.each(function (node) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots removeFromTabIndex(node);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots setARIARole(node, MENUITEM);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots });
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oMenuLabelNodes = oRootMenu.queryAll((PERIOD + CSS_MENU_LABEL));
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (oMenuLabelNodes) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oMenuLabelNodes.each(function (node) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oMenuLabel = node;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oMenuToggle = node.query((PERIOD + getClassName(MENU, "toggle")));
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (oMenuToggle) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots setARIAPresentation(oMenuToggle);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots removeFromTabIndex(oMenuToggle);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oMenuLabel = oMenuToggle.previous();
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots setARIARole(oMenuLabel, MENUITEM);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots setARIAProperty(oMenuLabel, "haspopup", TRUE);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots removeFromTabIndex(oMenuLabel);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots sID = oMenuLabel.get(ID);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (!sID) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots sID = Y.guid();
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oMenuLabel.set(ID, sID);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oSubmenu = node.next();
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots setARIARole(oSubmenu, MENU);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots setARIAProperty(oSubmenu, "labelledby", sID);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots setARIAProperty(oSubmenu, HIDDEN, TRUE);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots });
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oFirstItem = getFirstItem(oRootMenu);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (oFirstItem) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots placeInDefaultTabIndex(getItemAnchor(oFirstItem));
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menuNav._firstItem = oFirstItem;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots};
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd KlootsMenuNav.NAME = "nodeMenuNav";
5f40f927dba3cf399373572f6ed6fe59a376376eTodd KlootsMenuNav.NS = "nodeMenuNav";
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
de413b3e25c9cba63ab4b3003f5a4524d49f9f05Todd Kloots
8a4137ab24ac4a19400c698a65cf8ca511b081c5Todd Kloots/**
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>&#60;select&#62;</code> elements from poking through menus in IE 6.
979600728148238bdf1eee52b1457d1d180c126eTodd Kloots* @default "Menu Stacking Shim"
a82da1da5f01d59992c338f04dcbc9dd34002d63Todd Kloots* @type String
a82da1da5f01d59992c338f04dcbc9dd34002d63Todd Kloots*/
a82da1da5f01d59992c338f04dcbc9dd34002d63Todd KlootsMenuNav.SHIM_TEMPLATE_TITLE = "Menu Stacking Shim";
a82da1da5f01d59992c338f04dcbc9dd34002d63Todd Kloots
a82da1da5f01d59992c338f04dcbc9dd34002d63Todd Kloots
a82da1da5f01d59992c338f04dcbc9dd34002d63Todd Kloots/**
a82da1da5f01d59992c338f04dcbc9dd34002d63Todd Kloots* @property NodeMenuNav.SHIM_TEMPLATE
a82da1da5f01d59992c338f04dcbc9dd34002d63Todd Kloots* @description String representing the HTML used to create the <code>&#60;iframe&#62;</code> shim
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots* used to prevent <code>&#60;select&#62;</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
a82da1da5f01d59992c338f04dcbc9dd34002d63Todd Kloots*/
8a4137ab24ac4a19400c698a65cf8ca511b081c5Todd Kloots
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 Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd KlootsMenuNav.SHIM_TEMPLATE = '<iframe frameborder="0" role="presentation" class="' +
de413b3e25c9cba63ab4b3003f5a4524d49f9f05Todd Kloots getClassName("shim") +
8a4137ab24ac4a19400c698a65cf8ca511b081c5Todd Kloots '" title="' + MenuNav.SHIM_TEMPLATE_TITLE +
8a4137ab24ac4a19400c698a65cf8ca511b081c5Todd Kloots '" src="javascript:false;"></iframe>';
8a4137ab24ac4a19400c698a65cf8ca511b081c5Todd Kloots
8a4137ab24ac4a19400c698a65cf8ca511b081c5Todd Kloots
8a4137ab24ac4a19400c698a65cf8ca511b081c5Todd KlootsMenuNav.prototype = {
8a4137ab24ac4a19400c698a65cf8ca511b081c5Todd Kloots
8a4137ab24ac4a19400c698a65cf8ca511b081c5Todd Kloots // Protected properties
8a4137ab24ac4a19400c698a65cf8ca511b081c5Todd Kloots
8a4137ab24ac4a19400c698a65cf8ca511b081c5Todd Kloots /**
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
a82da1da5f01d59992c338f04dcbc9dd34002d63Todd Kloots */
a82da1da5f01d59992c338f04dcbc9dd34002d63Todd Kloots _rootMenu: NULL,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots /**
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 */
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots _activeItem: NULL,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots /**
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 */
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots _activeMenu: NULL,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots /**
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 */
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots _hasFocus: FALSE,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
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
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots /**
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
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots */
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots _blockMouseEvent: FALSE,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots /**
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 */
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots _currentMouseX: 0,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots /**
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
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots */
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots _movingToSubmenu: FALSE,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots /**
5f40f927dba3cf399373572f6ed6fe59a376376eTodd 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 */
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots _showSubmenuTimer: NULL,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots /**
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @property _hideSubmenuTimer
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @description Timer used to hide a submenu.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @default null
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @type Object
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots */
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots _hideSubmenuTimer: NULL,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots /**
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
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots */
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots _hideAllSubmenusTimer: NULL,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots /**
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
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots */
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots _firstItem: NULL,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots /**
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 */
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots _autoSubmenuDisplay: TRUE,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // Protected methods
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots /**
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 */
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots _isRoot: function (menu) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots return this._rootMenu.compareTo(menu);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots },
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots /**
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 */
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots _getTopmostSubmenu: function (menu) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots var menuNav = this,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oMenu = getParentMenu(menu),
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots returnVal;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (!oMenu) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots returnVal = menu;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots else if (menuNav._isRoot(oMenu)) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots returnVal = menu;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots else {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots returnVal = menuNav._getTopmostSubmenu(oMenu);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots return returnVal;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots },
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots /**
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @method _clearActiveItem
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @description Clears the MenuNav's active descendent.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @protected
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots */
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots _clearActiveItem: function () {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots var menuNav = this,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oActiveItem = menuNav._activeItem;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (oActiveItem) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oActiveItem.removeClass(getActiveClass(oActiveItem));
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (menuNav._useARIA) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots removeFromTabIndex(getItemAnchor(oActiveItem));
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._activeItem = NULL;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots },
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots /**
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 */
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots _setActiveItem: function (item) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots var menuNav = this;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._clearActiveItem();
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots item.addClass(getActiveClass(item));
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (menuNav._useARIA) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots placeInDefaultTabIndex(getItemAnchor(item));
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menuNav._activeItem = item;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots },
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots /**
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.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots */
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots _focusItem: function (item) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (this._hasFocus) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
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
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots later(0, null, focusItem, item);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots },
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots /**
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @method _showMenu
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description Shows the specified menu.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @param {Node} menu Node instance representing a menu.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots */
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots _showMenu: function (menu) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots var menuNav = this,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oParentMenu = getParentMenu(menu),
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oLI = menu.get(PARENT_NODE),
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots aXY = oLI.getXY(),
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oIFrame,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oItem;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (isHorizontalMenu(oParentMenu)) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots aXY[1] = aXY[1] + oLI.get(OFFSET_HEIGHT);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots else {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots aXY[0] = aXY[0] + oLI.get(OFFSET_WIDTH);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menu.setXY(aXY);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (UA.ie < 8) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (UA.ie === 6 && !menu.iframeShim) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menu.appendChild(Y.Node.create(MenuNav.SHIM_TEMPLATE));
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menu.iframeShim = oIFrame;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // Clear previous values for height and width
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menu.setStyles({ height: EMPTY_STRING, width: EMPTY_STRING });
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
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.
fab450bda25d83fc914a6413dcd83d3c9919282dTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menu.setStyles({
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots height: (menu.get(OFFSET_HEIGHT) + PX),
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots width: (menu.get(OFFSET_WIDTH) + PX) });
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menu.previous().addClass(CSS_MENU_LABEL_MENUVISIBLE);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menu.removeClass(CSS_MENU_HIDDEN);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (menuNav._useARIA) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots setARIAProperty(menu, HIDDEN, FALSE);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oItem = getFirstItem(menu);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._focusItem(oItem);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots },
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots /**
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 */
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots _hideMenu: function (menu, activateAndFocusLabel) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots var menuNav = this,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oLabel = menu.previous(),
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oActiveItem;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oLabel.removeClass(CSS_MENU_LABEL_MENUVISIBLE);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (activateAndFocusLabel) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menuNav._setActiveItem(oLabel);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menuNav._focusItem(oLabel);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oActiveItem = menu.query((PERIOD + CSS_MENUITEM_ACTIVE));
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (oActiveItem) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oActiveItem.removeClass(CSS_MENUITEM_ACTIVE);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
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.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menu.setStyles({ left: EMPTY_STRING, top: EMPTY_STRING });
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menu.addClass(CSS_MENU_HIDDEN);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots setARIAProperty(menu, HIDDEN, TRUE);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots },
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots /**
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.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots */
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots _hideAllSubmenus: function (menu) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots var menuNav = this,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oSubmenus = menu.queryAll(MENU_SELECTOR);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (oSubmenus) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oSubmenus.each(Y.bind(function (submenuNode) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menuNav._hideMenu(submenuNode);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }, menuNav));
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots },
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots /**
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @method _cancelShowSubmenuTimer
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @description Cancels the timer used to show a submenu.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * @protected
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots */
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots _cancelShowSubmenuTimer: function () {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots var menuNav = this,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oShowSubmenuTimer = menuNav._showSubmenuTimer;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (oShowSubmenuTimer) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oShowSubmenuTimer.cancel();
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._showSubmenuTimer = NULL;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots },
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots /**
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @method _cancelHideSubmenuTimer
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @description Cancels the timer used to hide a submenu.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots * @protected
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots */
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots _cancelHideSubmenuTimer: function () {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots var menuNav = this,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oHideSubmenuTimer = menuNav._hideSubmenuTimer;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (oHideSubmenuTimer) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oHideSubmenuTimer.cancel();
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._hideSubmenuTimer = NULL;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots },
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // Event handlers for discrete pieces of pieces of the menu
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots /**
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 */
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots _onMenuMouseOver: function (menu, event) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots var menuNav = this,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oHideAllSubmenusTimer = menuNav._hideAllSubmenusTimer;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (oHideAllSubmenusTimer) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oHideAllSubmenusTimer.cancel();
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menuNav._hideAllSubmenusTimer = NULL;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menuNav._cancelHideSubmenuTimer();
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menuNav._activeMenu = menu;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (menuNav._movingToSubmenu && isHorizontalMenu(menu)) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._movingToSubmenu = FALSE;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots },
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots /**
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 */
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots _onMenuMouseOut: function (menu, event) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots var menuNav = this,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oActiveMenu = menuNav._activeMenu,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oRelatedTarget = event.relatedTarget,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oActiveItem = menuNav._activeItem,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oParentMenu,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oMenu;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (oActiveMenu && !oActiveMenu.contains(oRelatedTarget)) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oParentMenu = getParentMenu(oActiveMenu);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (oParentMenu && !oParentMenu.contains(oRelatedTarget)) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (menuNav._mouseOutHideDelay > 0) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._cancelShowSubmenuTimer();
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._hideAllSubmenusTimer =
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots later(menuNav._mouseOutHideDelay, menuNav, function () {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots var oSubmenu;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oActiveMenu = menuNav._activeMenu;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._hideAllSubmenus(menuNav._rootMenu);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (oActiveMenu) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // Focus the label element for the topmost submenu
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oSubmenu = menuNav._getTopmostSubmenu(oActiveMenu);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._focusItem(oSubmenu.previous());
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots });
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots else {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (oActiveItem) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oMenu = getParentMenu(oActiveItem);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (!menuNav._isRoot(oMenu)) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._focusItem(oMenu.previous());
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots },
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots /**
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 */
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots _onMenuLabelMouseOver: function (menuLabel, event) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots var menuNav = this,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oActiveMenu = menuNav._activeMenu,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots bIsRoot = menuNav._isRoot(oActiveMenu),
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots bUseAutoSubmenuDisplay = (menuNav._autoSubmenuDisplay && bIsRoot || !bIsRoot),
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oSubmenu;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menuNav._setActiveItem(menuLabel);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menuNav._focusItem(menuLabel);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (bUseAutoSubmenuDisplay && !menuNav._movingToSubmenu) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._cancelHideSubmenuTimer();
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._cancelShowSubmenuTimer();
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (!hasVisibleSubmenu(menuLabel)) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oSubmenu = menuLabel.next();
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (oSubmenu) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._hideAllSubmenus(oActiveMenu);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._showSubmenuTimer =
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots later(menuNav._submenuShowDelay, menuNav,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._showMenu, oSubmenu);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots },
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots /**
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 */
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots _onMenuLabelMouseOut: function (menuLabel, event) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots var menuNav = this,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots bIsRoot = menuNav._isRoot(menuNav._activeMenu),
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots bUseAutoSubmenuDisplay = (menuNav._autoSubmenuDisplay && bIsRoot || !bIsRoot),
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oRelatedTarget = event.relatedTarget,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oSubmenu = menuLabel.next();
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menuNav._clearActiveItem();
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (bUseAutoSubmenuDisplay) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (menuNav._movingToSubmenu && !menuNav._showSubmenuTimer && oSubmenu) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
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
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._hideSubmenuTimer = later(menuNav._submenuHideDelay, menuNav,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._hideMenu, oSubmenu);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots else if (!menuNav._movingToSubmenu && oSubmenu &&
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots !oSubmenu.contains(oRelatedTarget) && oRelatedTarget !== oSubmenu) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
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
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menuNav._cancelShowSubmenuTimer();
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._hideMenu(oSubmenu);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots },
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots /**
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 */
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots _onMenuItemMouseOver: function (menuItem, event) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots var menuNav = this,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oActiveMenu = menuNav._activeMenu,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots bIsRoot = menuNav._isRoot(oActiveMenu),
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots bUseAutoSubmenuDisplay = (menuNav._autoSubmenuDisplay && bIsRoot || !bIsRoot);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menuNav._setActiveItem(menuItem);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menuNav._focusItem(menuItem);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (bUseAutoSubmenuDisplay && !menuNav._movingToSubmenu) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._hideAllSubmenus(oActiveMenu);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots },
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots /**
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 */
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots _onMenuItemMouseOut: function (menuItem, event) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots this._clearActiveItem();
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots },
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots /**
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 */
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots _onVerticalMenuKeyDown: function (event) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots var menuNav = this,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oActiveMenu = menuNav._activeMenu,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oRootMenu = menuNav._rootMenu,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oTarget = event.target,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oFocusedItem = getItem(oTarget, TRUE),
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots bPreventDefault = FALSE,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots nKeyCode = event.keyCode,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oSubmenu,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oParentMenu,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oLI,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oNextItem,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oItem;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots switch (nKeyCode) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots case 37: // left arrow
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oParentMenu = getParentMenu(oActiveMenu);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (oParentMenu && isHorizontalMenu(oParentMenu)) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._hideMenu(oActiveMenu);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oLI = getPreviousSibling(oActiveMenu.get(PARENT_NODE));
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oItem = getItem(oLI);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (oItem) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (isMenuLabel(oItem)) { // Menu label
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oSubmenu = oItem.next();
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (oSubmenu) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._showMenu(oSubmenu);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._setActiveItem(getFirstItem(oSubmenu));
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots else { // MenuItem
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._setActiveItem(oItem);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots focusItem(oItem);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots else if (!menuNav._isRoot(oActiveMenu)) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._hideMenu(oActiveMenu, TRUE);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots bPreventDefault = TRUE;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots break;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots case 39: // right arrow
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (isMenuLabel(oTarget)) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oSubmenu = oTarget.next();
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (oSubmenu) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._showMenu(oSubmenu);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._setActiveItem(getFirstItem(oSubmenu));
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots else if (isHorizontalMenu(oRootMenu)) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oSubmenu = menuNav._getTopmostSubmenu(oActiveMenu);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oLI = getNextSibling(oSubmenu.get(PARENT_NODE));
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oItem = getItem(oLI);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._hideAllSubmenus(oRootMenu);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (oItem) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (isMenuLabel(oItem)) { // Menu label
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oSubmenu = oItem.next();
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (oSubmenu) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._showMenu(oSubmenu);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._setActiveItem(getFirstItem(oSubmenu));
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots else { // MenuItem
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menuNav._setActiveItem(oItem);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots focusItem(oItem);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots bPreventDefault = TRUE;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots break;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots case 38: // up arrow
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots case 40: // down arrow
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menuNav._hideAllSubmenus(oActiveMenu);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oNextItem = nKeyCode === 38 ?
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots getPreviousItem(oFocusedItem) : getNextItem(oFocusedItem);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._setActiveItem(oNextItem);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots focusItem(oNextItem);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots bPreventDefault = TRUE;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots break;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (bPreventDefault) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // Prevent the browser from scrolling the window
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots event.preventDefault();
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots },
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots /**
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 */
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots _onHorizontalMenuKeyDown: function (event) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots var menuNav = this,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oActiveMenu = menuNav._activeMenu,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oTarget = event.target,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oFocusedItem = getItem(oTarget, TRUE),
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots bPreventDefault = FALSE,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots nKeyCode = event.keyCode,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oNextItem,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oSubmenu;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots switch (nKeyCode) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots case 37: // left arrow
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots case 39: // right arrow
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._hideAllSubmenus(oActiveMenu);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oNextItem = nKeyCode === 37 ?
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots getPreviousItem(oFocusedItem) : getNextItem(oFocusedItem);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menuNav._setActiveItem(oNextItem);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots focusItem(oNextItem);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots bPreventDefault = TRUE;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots break;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots case 40: // down arrow
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menuNav._hideAllSubmenus(oActiveMenu);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (isMenuLabel(oFocusedItem)) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oSubmenu = oFocusedItem.next();
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (oSubmenu) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._showMenu(oSubmenu);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._setActiveItem(getFirstItem(oSubmenu));
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots bPreventDefault = TRUE;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots break;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (bPreventDefault) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // Prevent the browser from scrolling the window
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots event.preventDefault();
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots },
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // Generic DOM Event handlers
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots /**
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 */
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots _onMouseMove: function (event) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots var menuNav = this;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
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.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots later(10, menuNav, function () {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menuNav._currentMouseX = event.pageX;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots });
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots },
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots /**
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.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots */
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots _onMouseOver: function (event) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots var menuNav = this,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oTarget,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oMenu,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oMenuLabel,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oParentMenu,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oMenuItem;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (menuNav._blockMouseEvent) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menuNav._blockMouseEvent = FALSE;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots else {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oTarget = event.target;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oMenu = getMenu(oTarget, TRUE);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oMenuLabel = getMenuLabel(oTarget, TRUE);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oMenuItem = getMenuItem(oTarget, TRUE);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (handleMouseOverForNode(oMenu, oTarget)) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._onMenuMouseOver(oMenu, event);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oMenu[HANDLED_MOUSEOVER] = TRUE;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oMenu[HANDLED_MOUSEOUT] = FALSE;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oParentMenu = getParentMenu(oMenu);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (oParentMenu) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oParentMenu[HANDLED_MOUSEOUT] = TRUE;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oParentMenu[HANDLED_MOUSEOVER] = FALSE;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (handleMouseOverForNode(oMenuLabel, oTarget)) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._onMenuLabelMouseOver(oMenuLabel, event);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oMenuLabel[HANDLED_MOUSEOVER] = TRUE;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oMenuLabel[HANDLED_MOUSEOUT] = FALSE;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (handleMouseOverForNode(oMenuItem, oTarget)) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._onMenuItemMouseOver(oMenuItem, event);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oMenuItem[HANDLED_MOUSEOVER] = TRUE;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oMenuItem[HANDLED_MOUSEOUT] = FALSE;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots },
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots /**
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.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots */
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots _onMouseOut: function (event) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots var menuNav = this,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oActiveMenu = menuNav._activeMenu,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots bMovingToSubmenu = FALSE,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oTarget,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oRelatedTarget,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oMenu,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oMenuLabel,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oSubmenu,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oMenuItem;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menuNav._movingToSubmenu = (oActiveMenu && !isHorizontalMenu(oActiveMenu) &&
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots ((event.pageX - 5) > menuNav._currentMouseX));
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oTarget = event.target;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oRelatedTarget = event.relatedTarget;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oMenu = getMenu(oTarget, TRUE);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oMenuLabel = getMenuLabel(oTarget, TRUE);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oMenuItem = getMenuItem(oTarget, TRUE);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (handleMouseOutForNode(oMenuLabel, oRelatedTarget)) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._onMenuLabelMouseOut(oMenuLabel, event);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oMenuLabel[HANDLED_MOUSEOUT] = TRUE;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oMenuLabel[HANDLED_MOUSEOVER] = FALSE;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (handleMouseOutForNode(oMenuItem, oRelatedTarget)) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menuNav._onMenuItemMouseOut(oMenuItem, event);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oMenuItem[HANDLED_MOUSEOUT] = TRUE;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oMenuItem[HANDLED_MOUSEOVER] = FALSE;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (oMenuLabel) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oSubmenu = oMenuLabel.next();
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (oSubmenu && (oRelatedTarget === oSubmenu || oSubmenu.contains(oRelatedTarget))) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots bMovingToSubmenu = TRUE;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (handleMouseOutForNode(oMenu, oRelatedTarget) || bMovingToSubmenu) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._onMenuMouseOut(oMenu, event);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oMenu[HANDLED_MOUSEOUT] = TRUE;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oMenu[HANDLED_MOUSEOVER] = FALSE;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots },
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots /**
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 */
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots _toggleSubmenuDisplay: function (event) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots var menuNav = this,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oTarget = event.target,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oMenuLabel = getMenuLabel(oTarget, TRUE),
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots sType = event.type,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oAnchor,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oSubmenu,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots sHref,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots nHashPos,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots nLen,
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots sId;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (oMenuLabel) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oAnchor = isAnchor(oTarget) ? oTarget : oTarget.ancestor(isAnchor);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (oAnchor) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
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
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots sHref = oAnchor.getAttribute("href", 2);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots nHashPos = sHref.indexOf("#");
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots nLen = sHref.length;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (nHashPos === 0 && nLen > 1) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots sId = sHref.substr(1, nLen);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots oSubmenu = oMenuLabel.next();
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (oSubmenu && (oSubmenu.get(ID) === sId)) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (sType === MOUSEDOWN || (sType === KEYDOWN && event.keyCode === 13)) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
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.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (UA.webkit && !menuNav._hasFocus) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._hasFocus = TRUE;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (hasVisibleSubmenu(oMenuLabel)) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._hideMenu(oSubmenu);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots focusItem(oMenuLabel);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots else {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menuNav._hideAllSubmenus(menuNav._rootMenu);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menuNav._showMenu(oSubmenu);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (sType === CLICK) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // Prevent the browser from following the URL of the anchor element
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots event.preventDefault();
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots },
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots /**
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.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots */
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots _onKeyPress: function (event) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots switch (event.keyCode) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots case 37: // left arrow
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots case 38: // up arrow
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots case 39: // right arrow
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots case 40: // down arrow
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // Prevent the browser from scrolling the window
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots event.preventDefault();
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots break;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots },
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots /**
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.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots */
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots _onKeyDown: function (event) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots var menuNav = this,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oActiveItem = menuNav._activeItem,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oTarget = event.target,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oActiveMenu = getParentMenu(oTarget);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (oActiveMenu) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menuNav._activeMenu = oActiveMenu;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (isHorizontalMenu(oActiveMenu)) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menuNav._onHorizontalMenuKeyDown(event);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots else {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._onVerticalMenuKeyDown(event);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (event.keyCode === 27) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (!menuNav._isRoot(oActiveMenu)) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._hideMenu(oActiveMenu, TRUE);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots event.stopPropagation();
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menuNav._blockMouseEvent = UA.gecko ? TRUE : FALSE;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots else if (oActiveItem) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots blurItem(oTarget);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._clearActiveItem();
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots },
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots /**
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 */
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots _onDocMouseDown: function (event) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots var menuNav = this,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oRoot = menuNav._rootMenu,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oTarget = event.target;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (!oRoot.compareTo(oTarget) && !oRoot.contains(oTarget)) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menuNav._hideAllSubmenus(oRoot);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
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.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots if (UA.webkit) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._hasFocus = FALSE;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._clearActiveItem();
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots },
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots /**
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.
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots */
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots _onDocFocus: function (event) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots var menuNav = this,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots bUseARIA = menuNav._useARIA,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oFirstItem = menuNav._firstItem,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oActiveItem = menuNav._activeItem,
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oTarget = event.target;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (menuNav._rootMenu.contains(oTarget)) { // The menu has focus
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (!menuNav._hasFocus) { // Initial focus
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots // First time the menu has been focused, need to setup focused state and
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots // established active active descendant
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._hasFocus = TRUE;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots oActiveItem = getItem(oTarget, TRUE);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (oActiveItem) {
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots menuNav._setActiveItem(oActiveItem);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots else { // The menu has lost focus
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menuNav._clearActiveItem();
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots menuNav._hasFocus = FALSE;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots if (oFirstItem && bUseARIA) {
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots placeInDefaultTabIndex(getItemAnchor(oFirstItem));
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots }
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
de413b3e25c9cba63ab4b3003f5a4524d49f9f05Todd Kloots};
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd KlootsY.namespace('Plugin');
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd KlootsY.Plugin.NodeMenuNav = MenuNav;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots}, '@VERSION@' ,{requires:['node', 'classnamemanager']});
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots