diff --git a/react/src/lib/components/SmartNodeSelector/components/Suggestions.tsx b/react/src/lib/components/SmartNodeSelector/components/Suggestions.tsx index 9aa93548..fc1788f4 100644 --- a/react/src/lib/components/SmartNodeSelector/components/Suggestions.tsx +++ b/react/src/lib/components/SmartNodeSelector/components/Suggestions.tsx @@ -9,9 +9,12 @@ import React, { Component, Fragment, MouseEvent } from "react"; import ReactDOM from "react-dom"; import classNames from "classnames"; import PropTypes from "prop-types"; -import "./Suggestions.css"; + import TreeNodeSelection from "../utils/TreeNodeSelection"; import { TreeDataNodeMetaData } from "../utils/TreeDataNodeTypes"; +import { findHighestZIndex } from "../../../utils/dom"; + +import "./Suggestions.css"; type SuggestionsProps = { suggestionsRef: React.RefObject; @@ -418,9 +421,7 @@ class Suggestions extends Component { }; const zIndex = this.positionRef.current - ? parseInt( - window.getComputedStyle(this.positionRef.current, null).zIndex - ) + ? findHighestZIndex(this.positionRef.current) + 1 : 99; ReactDOM.render( diff --git a/react/src/lib/utils/dom.ts b/react/src/lib/utils/dom.ts new file mode 100644 index 00000000..0e014da3 --- /dev/null +++ b/react/src/lib/utils/dom.ts @@ -0,0 +1,14 @@ +export const findHighestZIndex = (element: Element): number => { + let currentElement: Element | null = element; + let highestZIndex = 0; + while (currentElement) { + const currentZIndex = parseInt( + window.getComputedStyle(currentElement, null).zIndex + ); + if (!isNaN(currentZIndex)) { + highestZIndex = Math.max(highestZIndex, currentZIndex); + } + currentElement = currentElement.parentElement; + } + return highestZIndex; +};