From 407310effd13e34b962cadd25603d2cbac919965 Mon Sep 17 00:00:00 2001 From: makhnatkin Date: Thu, 9 Oct 2025 19:24:57 +0200 Subject: [PATCH] fix(toolbar): revert broken z-index logic for popups --- src/bundle/ToolbarView.tsx | 3 --- src/bundle/settings/index.tsx | 5 ----- src/bundle/toolbar/ToolbarButtonWithPopupMenu.tsx | 4 ---- src/common/layout.ts | 3 --- src/toolbar/ToolbarListButton.tsx | 10 +--------- src/utils/get-target-z-index.ts | 12 ------------ 6 files changed, 1 insertion(+), 36 deletions(-) delete mode 100644 src/common/layout.ts delete mode 100644 src/utils/get-target-z-index.ts diff --git a/src/bundle/ToolbarView.tsx b/src/bundle/ToolbarView.tsx index 059c8a3c3..78a755167 100644 --- a/src/bundle/ToolbarView.tsx +++ b/src/bundle/ToolbarView.tsx @@ -3,8 +3,6 @@ import {useLayoutEffect, useRef} from 'react'; import type {QAProps} from '@gravity-ui/uikit'; import {useUpdate} from 'react-use'; -import {LAYOUT} from 'src/common/layout'; - import type {ClassNameProps} from '../classname'; import {i18n} from '../i18n/menubar'; import {useSticky} from '../react-utils/useSticky'; @@ -67,7 +65,6 @@ export function ToolbarView({ }, [className], )} - data-layout={LAYOUT.STICKY_TOOLBAR} > (function EditorSettings( anchorElement={chevronElement} placement={placement} onOpenChange={hidePopup} - zIndex={getTargetZIndex(LAYOUT.STICKY_TOOLBAR)} > = function SettingsContent popoverProps={{ placement: mdHelpPlacement, modal: false, - zIndex: getTargetZIndex(LAYOUT.STICKY_TOOLBAR), }} className={bContent('mode-help')} > diff --git a/src/bundle/toolbar/ToolbarButtonWithPopupMenu.tsx b/src/bundle/toolbar/ToolbarButtonWithPopupMenu.tsx index 0bd6a9ea1..77ef301bc 100644 --- a/src/bundle/toolbar/ToolbarButtonWithPopupMenu.tsx +++ b/src/bundle/toolbar/ToolbarButtonWithPopupMenu.tsx @@ -11,9 +11,6 @@ import { type PopupProps, } from '@gravity-ui/uikit'; -import {LAYOUT} from 'src/common/layout'; -import {getTargetZIndex} from 'src/utils/get-target-z-index'; - import {cn} from '../../classname'; import type {Action} from '../../core'; import {groupBy, isFunction} from '../../lodash'; @@ -130,7 +127,6 @@ export const ToolbarButtonWithPopupMenu: React.FC { if (!open) hide(); }} - zIndex={getTargetZIndex(LAYOUT.STICKY_TOOLBAR)} > {Object.entries(groups).map(([label, items], key) => { diff --git a/src/common/layout.ts b/src/common/layout.ts deleted file mode 100644 index 1cbf17458..000000000 --- a/src/common/layout.ts +++ /dev/null @@ -1,3 +0,0 @@ -export const LAYOUT = { - STICKY_TOOLBAR: 'sticky-toolbar', -}; diff --git a/src/toolbar/ToolbarListButton.tsx b/src/toolbar/ToolbarListButton.tsx index 3847295a1..770a2d6f1 100644 --- a/src/toolbar/ToolbarListButton.tsx +++ b/src/toolbar/ToolbarListButton.tsx @@ -3,9 +3,6 @@ import {Fragment, useEffect, useState} from 'react'; import {ChevronDown} from '@gravity-ui/icons'; import {HelpMark, Hotkey, Icon, Menu, Popover, Popup} from '@gravity-ui/uikit'; -import {LAYOUT} from 'src/common/layout'; -import {getTargetZIndex} from 'src/utils/get-target-z-index'; - import {cn} from '../classname'; import {i18n} from '../i18n/common'; import {isFunction} from '../lodash'; @@ -97,12 +94,7 @@ export function ToolbarListButton({ > {buttonContent} - + {data .map((data) => { diff --git a/src/utils/get-target-z-index.ts b/src/utils/get-target-z-index.ts deleted file mode 100644 index 5e4af22ca..000000000 --- a/src/utils/get-target-z-index.ts +++ /dev/null @@ -1,12 +0,0 @@ -export function getTargetZIndex(dataLayoutSelector: string, offset = 10) { - const targetLayerElement = document.querySelector(`[data-layout="${dataLayoutSelector}"]`); - - if (!targetLayerElement) { - return offset; - } - - const computedStyle = window.getComputedStyle(targetLayerElement); - const targetZIndex = parseInt(computedStyle.zIndex, 10); - - return Number.isFinite(targetZIndex) ? targetZIndex + offset : offset; -}