function findNextElement(mParams) {
		let bSkipChild = mParams.skipChild;
		const oScope = mParams.scope;

		if (mParams.element?.id === "sap-ui-static") {
			// skip the check in static UIArea
			// when oScope is within static UIArea, this function will never reach the static UIArea
			bSkipChild = true;
		}

		const stack = [{
			element: mParams.element,
			skipChild: bSkipChild
		}];

		while (stack.length) {
			const oCurrent = stack.pop();
			const oElement = oCurrent.element;

			if (!oElement) {
				return null;
			}

			// First check for child elements
			if (!oCurrent.skipChild) {
				if (oElement.shadowRoot && oElement.shadowRoot.firstElementChild) {
					return oElement.shadowRoot.firstElementChild;
				} else if (oElement.assignedElements && oElement.assignedElements().length) {
					return oElement.assignedElements()[0];
				} else if (oElement.firstElementChild) {
					return oElement.firstElementChild;
				}
			} else if (oElement === oScope) {
				// return the scope when the scope is reached during backwards traversing
				return oScope;
			}

			// If there are no child elements or in case we children were skipped, check for the next sibling
			// Next element sibling should be only considered if there is no slot assigned (no Web Component)
			// If a slot is assigned, check for the next logical slot element (Web Component)
			// nextElementSibling also returns the next slot element but the slot elements in DOM must not
			// necessarily be grouped by the slots
			if (oElement.assignedSlot) {
				var aAssignedElements = oElement.assignedSlot.assignedElements();
				var iNextSlotIndex = aAssignedElements.indexOf(oElement) + 1;
				if (iNextSlotIndex < aAssignedElements.length) {
					return aAssignedElements[iNextSlotIndex];
				}
			} else if (oElement.nextElementSibling) {
				return oElement.nextElementSibling;
			}

			stack.push({
				element: oElement.assignedSlot || oElement.parentElement || oElement.parentNode || oElement.host,
				skipChild: true
			});
		}

		return null;
	}
Finds the next element in the DOM tree based on the given parameters.
@param {Object} mParams The parameters for finding the next element.
@param {Element} mParams.element The current element.
@param {boolean} mParams.skipChild Whether to skip child elements.
@param {Element} mParams.scope The scope within which to find the next element.
@returns {Element|null} The next element in the DOM tree.