src/sap.ui.commons/src/sap/ui/commons/MenuBar.js
function(oThis){
		var iVisibleItems = getVisibleItemCount(oThis);
		var _iVisibleItems = iVisibleItems;

		var jAreaRef = oThis.$("area");
		var jItems = jAreaRef.children();
		var jOvrFlwRef = oThis.$("ovrflw");

		var bUpdateFocus = false;

		if (iVisibleItems < jItems.length - 1) {
			jOvrFlwRef.attr("style", "display:block;");
			if (!oThis.oOvrFlwMnu) {
				oThis.oOvrFlwMnu = new Menu(oThis.getId() + "-ovrflwmnu");
				oThis.oOvrFlwMnu.bUseTopStyle = oThis.getDesign() == MenuBarDesign.Header;
				oThis.oOvrFlwMnu.attachItemSelect(function(oEvent){
					var oItem = oEvent.getParameter("item");
					if (!(oItem instanceof _DelegatorMenuItem)) {
						var oItemRootMenu = Menu.prototype.getRootMenu.apply(oItem.getParent());
						oItemRootMenu.fireItemSelect({item: oItem});
					} else if (oItem.bNoSubMenu && oItem instanceof _DelegatorMenuItem) {
						oItem.oAlterEgoItm.fireSelect({item: oItem.oAlterEgoItm});
					}
				});
			}
			oThis.oOvrFlwMnu.destroyItems();
			var aItems = oThis.getItems();
			for (var i = 0; i < aItems.length; i++) {
				var oItem = aItems[i];
				if (iVisibleItems != 0) {
					if (oItem.getVisible()) {
						iVisibleItems--;
					}
					if (iVisibleItems == 0) {
						oThis.sLastVisibleItemId = oItem.getId();
					}
				} else {
					oThis.oOvrFlwMnu.addItem(new _DelegatorMenuItem(oItem));
					if (oItem.getId() == oThis.sCurrentFocusedItemRefId) {
						bUpdateFocus = true;
					}
				}
			}
			if (sap.ui.getCore().getConfiguration().getAccessibility()) {
				jItems.attr("aria-setsize", _iVisibleItems + 1);
				jOvrFlwRef.attr("aria-posinset", _iVisibleItems + 1);
			}
		} else {
			jOvrFlwRef.attr("style", "display:none;");
			if (oThis.oOvrFlwMnu) {
				oThis.oOvrFlwMnu.destroyItems();
			}
			oThis.sLastVisibleItemId = null;
			if (sap.ui.getCore().getConfiguration().getAccessibility()) {
				jItems.attr("aria-setsize", _iVisibleItems);
				jOvrFlwRef.attr("aria-posinset", 0);
			}
		}

		jAreaRef.scrollTop(0);

		if (bUpdateFocus) {
			oThis.sCurrentFocusedItemRefId = oThis.sLastVisibleItemId;
			document.getElementById(oThis.sLastVisibleItemId).focus();
		}
	}
function(oThis){
		var iVisibleItems = getVisibleItemCount(oThis);
		var _iVisibleItems = iVisibleItems;

		var jAreaRef = oThis.$("area");
		var jItems = jAreaRef.children();
		var jOvrFlwRef = oThis.$("ovrflw");

		var bUpdateFocus = false;

		if (iVisibleItems < jItems.length - 1) {
			jOvrFlwRef.attr("style", "display:block;");
			if (!oThis.oOvrFlwMnu) {
				oThis.oOvrFlwMnu = new Menu(oThis.getId() + "-ovrflwmnu");
				oThis.oOvrFlwMnu.bUseTopStyle = oThis.getDesign() == MenuBarDesign.Header;
				oThis.oOvrFlwMnu.attachItemSelect(function(oEvent){
					var oItem = oEvent.getParameter("item");
					if (!(oItem instanceof _DelegatorMenuItem)) {
						var oItemRootMenu = Menu.prototype.getRootMenu.apply(oItem.getParent());
						oItemRootMenu.fireItemSelect({item: oItem});
					} else if (oItem.bNoSubMenu && oItem instanceof _DelegatorMenuItem) {
						oItem.oAlterEgoItm.fireSelect({item: oItem.oAlterEgoItm});
					}
				});
			}
			oThis.oOvrFlwMnu.destroyItems();
			var aItems = oThis.getItems();
			for (var i = 0; i < aItems.length; i++) {
				var oItem = aItems[i];
				if (iVisibleItems != 0) {
					if (oItem.getVisible()) {
						iVisibleItems--;
					}
					if (iVisibleItems == 0) {
						oThis.sLastVisibleItemId = oItem.getId();
					}
				} else {
					oThis.oOvrFlwMnu.addItem(new _DelegatorMenuItem(oItem));
					if (oItem.getId() == oThis.sCurrentFocusedItemRefId) {
						bUpdateFocus = true;
					}
				}
			}
			if (sap.ui.getCore().getConfiguration().getAccessibility()) {
				jItems.attr("aria-setsize", _iVisibleItems + 1);
				jOvrFlwRef.attr("aria-posinset", _iVisibleItems + 1);
			}
		} else {
			jOvrFlwRef.attr("style", "display:none;");
			if (oThis.oOvrFlwMnu) {
				oThis.oOvrFlwMnu.destroyItems();
			}
			oThis.sLastVisibleItemId = null;
			if (sap.ui.getCore().getConfiguration().getAccessibility()) {
				jItems.attr("aria-setsize", _iVisibleItems);
				jOvrFlwRef.attr("aria-posinset", 0);
			}
		}

		jAreaRef.scrollTop(0);

		if (bUpdateFocus) {
			oThis.sCurrentFocusedItemRefId = oThis.sLastVisibleItemId;
			document.getElementById(oThis.sLastVisibleItemId).focus();
		}
	}
function ( oThis ) { var iVisibleItems = getVisibleItemCount ( oThis ) ; var _iVisibleItems = iVisibleItems ; var jAreaRef = oThis . $ ( "area" ) ; var jItems = jAreaRef . children ( ) ; var jOvrFlwRef = oThis . $ ( "ovrflw" ) ; var bUpdateFocus = false ; if ( iVisibleItems < jItems . length - 1 ) { jOvrFlwRef . attr ( "style" , "display:block;" ) ; if ( ! oThis . oOvrFlwMnu ) { oThis . oOvrFlwMnu = new Menu ( oThis . getId ( ) + "-ovrflwmnu" ) ; oThis . oOvrFlwMnu . bUseTopStyle = oThis . getDesign ( ) == MenuBarDesign . Header ; oThis . oOvrFlwMnu . attachItemSelect ( function ( oEvent ) { var oItem = oEvent . getParameter ( "item" ) ; if ( ! ( oItem instanceof _DelegatorMenuItem ) ) { var oItemRootMenu = Menu . prototype . getRootMenu . apply ( oItem . getParent ( ) ) ; oItemRootMenu . fireItemSelect ( { item : oItem } ) ; } else if ( oItem . bNoSubMenu && oItem instanceof _DelegatorMenuItem ) { oItem . oAlterEgoItm . fireSelect ( { item : oItem . oAlterEgoItm } ) ; } } ) ; } oThis . oOvrFlwMnu . destroyItems ( ) ; var aItems = oThis . getItems ( ) ; for ( var i = 0 ; i < aItems . length ; i ++ ) { var oItem = aItems [ i ] ; if ( iVisibleItems != 0 ) { if ( oItem . getVisible ( ) ) { iVisibleItems -- ; } if ( iVisibleItems == 0 ) { oThis . sLastVisibleItemId = oItem . getId ( ) ; } } else { oThis . oOvrFlwMnu . addItem ( new _DelegatorMenuItem ( oItem ) ) ; if ( oItem . getId ( ) == oThis . sCurrentFocusedItemRefId ) { bUpdateFocus = true ; } } } if ( sap . ui . getCore ( ) . getConfiguration ( ) . getAccessibility ( ) ) { jItems . attr ( "aria-setsize" , _iVisibleItems + 1 ) ; jOvrFlwRef . attr ( "aria-posinset" , _iVisibleItems + 1 ) ; } } else { jOvrFlwRef . attr ( "style" , "display:none;" ) ; if ( oThis . oOvrFlwMnu ) { oThis . oOvrFlwMnu . destroyItems ( ) ; } oThis . sLastVisibleItemId = null ; if ( sap . ui . getCore ( ) . getConfiguration ( ) . getAccessibility ( ) ) { jItems . attr ( "aria-setsize" , _iVisibleItems ) ; jOvrFlwRef . attr ( "aria-posinset" , 0 ) ; } } jAreaRef . scrollTop ( 0 ) ; if ( bUpdateFocus ) { oThis . sCurrentFocusedItemRefId = oThis . sLastVisibleItemId ; document . getElementById ( oThis . sLastVisibleItemId ) . focus ( ) ; } }
Handle the resize of the menubar
Handle the resize of the menubar