Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix: stacking context golden path (#5287)
Peter Chinman3496b9133551
diff --git a/apps/web/src/components/app/side-panel/SidePanel.tsx b/apps/web/src/components/app/side-panel/SidePanel.tsxindex 015bc82116..31da044064 100644--- a/apps/web/src/components/app/side-panel/SidePanel.tsx+++ b/apps/web/src/components/app/side-panel/SidePanel.tsx@@ -27,7 +27,6 @@ import {} from 'solid-js';import { HeaderIsland } from '../split-layout/components/HeaderIsland';import { SplitHeaderRight } from '../split-layout/components/SplitHeader';-import { splitPanelLayer } from '../split-layout/layers';import {SidePanelContext,type SidePanelContextType,@@ -175,7 +174,7 @@ function SidePanelLayoutInner(maxSize={SIDE_MAX_PX}index={1}>- <div class={cn('relative size-full', splitPanelLayer.controls)}>+ <div class={'relative size-full z-split-panel-chrome'}><SidePanelOutletsections={props.sections}openIds={props.openIds}@@ -187,8 +186,7 @@ function SidePanelLayoutInner(<Show when={showOverlay()}><divclass={cn(- 'absolute inset-0 flex flex-col bg-surface',- splitPanelLayer.controls+ 'absolute inset-0 flex flex-col bg-surface z-split-panel-chrome')}><Scroll>diff --git a/apps/web/src/components/app/split-layout/components/SplitLabel.tsx b/apps/web/src/components/app/split-layout/components/SplitLabel.tsxindex f5ab24b056..fa23018652 100644--- a/apps/web/src/components/app/split-layout/components/SplitLabel.tsx+++ b/apps/web/src/components/app/split-layout/components/SplitLabel.tsx@@ -69,7 +69,7 @@ export function StaticSplitLabel(props: {><divclass={cn(- 'z-page-overlay relative flex items-center gap-2 max-w-full h-full shrink',+ 'z-split-header-content relative flex items-center gap-2 max-w-full h-full shrink',props.class)}>@@ -226,7 +226,7 @@ export function BlockItemSplitLabel(props: {class={cn('shrink', panel.titleFileMenuTrigger() && 'cursor-pointer')}onClick={openTitleFileMenu}>- <div class="ph-no-capture z-page-overlay relative flex items-center gap-2 min-w-0 max-w-full h-full shrink">+ <div class="ph-no-capture z-split-header-content relative flex items-center gap-2 min-w-0 max-w-full h-full shrink"><EntityIcon class="shrink-0" targetType={targetType()} size="xs" /><Show when={props.badges}>{props.badges}</Show><SplitLabeldiff --git a/apps/web/src/components/app/split-layout/components/SplitPanel.tsx b/apps/web/src/components/app/split-layout/components/SplitPanel.tsxindex 0c4395e346..a0897748d4 100644--- a/apps/web/src/components/app/split-layout/components/SplitPanel.tsx+++ b/apps/web/src/components/app/split-layout/components/SplitPanel.tsx@@ -30,7 +30,6 @@ import {SplitPanelContext,type SplitPanelContextType,} from '../context';-import { splitPanelLayer } from '../layers';import { useSplitLayout } from '../layout';import type { SplitHandle, SplitState } from '../layoutManager';import { registerSplitHotkeys } from '../registerSplitHotkeys';@@ -321,7 +320,7 @@ export function SplitPanel(props: SplitPanelProps) {<Panel.Headerclass={cn('relative block min-h-10.25 touch:min-h-11.25 p-0 overflow-visible border-b-0!',- splitPanelLayer.controls,+ 'z-split-panel-chrome',// On mobile the header collapses to a zero-height grid row;// SplitHeader overlays the body as floating islands.'mobile:min-h-0 mobile:border-b-0',diff --git a/apps/web/src/components/app/split-layout/layers.ts b/apps/web/src/components/app/split-layout/layers.tsdeleted file mode 100644index 8c607e0dc4..0000000000--- a/apps/web/src/components/app/split-layout/layers.ts+++ /dev/null@@ -1,3 +0,0 @@-export const splitPanelLayer = {- controls: 'z-30',-} as const;diff --git a/apps/web/src/features/block-automation/component/Automation.tsx b/apps/web/src/features/block-automation/component/Automation.tsxindex 929df90041..b53113d3f0 100644--- a/apps/web/src/features/block-automation/component/Automation.tsx+++ b/apps/web/src/features/block-automation/component/Automation.tsx@@ -236,7 +236,7 @@ export function Automation() {<><SplitHeaderLeft><HeaderIsland class="shrink">- <div class="z-page-overlay relative flex h-full w-screen max-w-full shrink items-center gap-2">+ <div class="z-split-header-content relative flex h-full w-screen max-w-full shrink items-center gap-2"><EntityIconclass="shrink-0"targetType="automation"diff --git a/apps/web/src/features/block-call/component/CallRecording/CallRecordingSplitHeader.tsx b/apps/web/src/features/block-call/component/CallRecording/CallRecordingSplitHeader.tsxindex 1760c6ffd4..9718b57164 100644--- a/apps/web/src/features/block-call/component/CallRecording/CallRecordingSplitHeader.tsx+++ b/apps/web/src/features/block-call/component/CallRecording/CallRecordingSplitHeader.tsx@@ -33,7 +33,7 @@ export function CallRecordingSplitHeaderLoading() {return (<SplitHeaderLeft><div class="h-full my-auto flex min-w-0 items-center justify-start gap-3">- <div class="ph-no-capture z-page-overlay relative flex h-full max-w-full min-w-0 shrink items-center gap-2">+ <div class="ph-no-capture z-split-header-content relative flex h-full max-w-full min-w-0 shrink items-center gap-2"><StaticSplitLabellabel="Call Recording"icon={@@ -119,7 +119,7 @@ export function CallRecordingSplitHeader(props: {<><SplitHeaderLeft><div class="h-full my-auto flex min-w-0 items-center justify-start gap-3">- <div class="ph-no-capture z-page-overlay relative flex h-full max-w-full min-w-0 shrink items-center gap-2">+ <div class="ph-no-capture z-split-header-content relative flex h-full max-w-full min-w-0 shrink items-center gap-2"><StaticSplitLabellabel={callName()}icon={diff --git a/apps/web/src/features/block-channel/component/Top.tsx b/apps/web/src/features/block-channel/component/Top.tsxindex 5e57e2a726..c4ef2828ff 100644--- a/apps/web/src/features/block-channel/component/Top.tsx+++ b/apps/web/src/features/block-channel/component/Top.tsx@@ -95,7 +95,7 @@ export function ChannelTopLeft(props: ChannelTopLeftProps) {fallback={<><HeaderIsland class="shrink">- <div class="ph-no-capture z-page-overlay relative flex items-center gap-2 max-w-full h-full shrink min-w-15">+ <div class="ph-no-capture z-split-header-content relative flex items-center gap-2 max-w-full h-full shrink min-w-15"><TopIconchannelType={props.channelType}participants={props.participants}diff --git a/apps/web/src/features/block-code/component/CodeFileTypeChip.tsx b/apps/web/src/features/block-code/component/CodeFileTypeChip.tsxindex e53f44ab8e..49e4bde067 100644--- a/apps/web/src/features/block-code/component/CodeFileTypeChip.tsx+++ b/apps/web/src/features/block-code/component/CodeFileTypeChip.tsx@@ -89,7 +89,7 @@ export function CodeFileTypeChip() {{fileType()}</Popover.Trigger><Popover.Portal>- <Popover.Content class="z-50 w-48 rounded shadow-md ring ring-edge bg-surface text-ink text-sm overflow-hidden">+ <Popover.Content class="z-action-menu w-48 rounded shadow-md ring ring-edge bg-surface text-ink text-sm overflow-hidden"><div class="p-1.5 border-b border-edge"><inputref={searchRef}diff --git a/apps/web/src/features/block-code/component/cmTheme.ts b/apps/web/src/features/block-code/component/cmTheme.tsindex e92231e72e..30934d3f5f 100644--- a/apps/web/src/features/block-code/component/cmTheme.ts+++ b/apps/web/src/features/block-code/component/cmTheme.ts@@ -106,7 +106,7 @@ const theme = EditorView.theme({},// Make sure selection appears above active line'.cm-selectionLayer': {- zIndex: 100,+ zIndex: 2,},'.cm-selectionMatch': {backgroundColor: base.selection,diff --git a/apps/web/src/features/block-md/component/MarkdownPopup.tsx b/apps/web/src/features/block-md/component/MarkdownPopup.tsxindex 90070c27f4..c2c7a26040 100644--- a/apps/web/src/features/block-md/component/MarkdownPopup.tsx+++ b/apps/web/src/features/block-md/component/MarkdownPopup.tsx@@ -823,7 +823,7 @@ export function MarkdownPopup(props: {<ScopedPortal scope="local"><divref={setAnchorRef}- class="absolute pointer-events-none z-50"+ class="absolute pointer-events-none"style={{left: `${anchorRefPosition().left}px`,top: `${anchorRefPosition().top}px`,diff --git a/apps/web/src/features/block-pdf/PdfViewer/InternalPDFViewer.ts b/apps/web/src/features/block-pdf/PdfViewer/InternalPDFViewer.tsindex 060b7f02cb..b9b9f6ceab 100644--- a/apps/web/src/features/block-pdf/PdfViewer/InternalPDFViewer.ts+++ b/apps/web/src/features/block-pdf/PdfViewer/InternalPDFViewer.ts@@ -1,5 +1,4 @@import { ENABLE_SCRIPTING } from '@core/constant/featureFlags';-import * as stackingContext from '@core/constant/stackingContext';import { showMessageBoxSync } from '@core/util/dialog';import debounce from 'lodash/debounce';import { AnnotationMode, type PageViewport } from 'pdfjs-dist';@@ -386,7 +385,7 @@ export class InternalPDFViewer {const inner = document.createElement('div');inner.className = 'pdfPopupInner';- inner.style.zIndex = `${stackingContext.zPopupViewer}`;+ inner.style.zIndex = 'var(--z-index-popup-viewer)';inner.style.visibility = 'visible';outer.appendChild(inner);@@ -518,7 +517,7 @@ export class InternalPDFViewer {this._floatingPopupContainer.style.width = `${width + SCROLLBAR_OFFSET}px`;this._floatingPopupContainer.style.top = `${Math.ceil(top)}px`;- this._floatingPopupContainer.style.zIndex = `${stackingContext.zPopupViewer}`;+ this._floatingPopupContainer.style.zIndex = 'var(--z-index-popup-viewer)';this._floatingPopupContainer.style.pointerEvents = 'all';this._viewer?.eventBus.dispatch('popupvisibilitychanged', {source: this,@@ -541,7 +540,9 @@ export class InternalPDFViewer {}private overrideInternalLinks(annotationLayerDiv: HTMLDivElement) {- annotationLayerDiv.style.zIndex = `${stackingContext.zAnnotationLayer + (!this._popupViewer ? stackingContext.zPopupViewer : 0)}`;+ annotationLayerDiv.style.zIndex = !this._popupViewer+ ? 'calc(var(--z-index-annotation-layer) + var(--z-index-popup-viewer))'+ : 'var(--z-index-annotation-layer)';annotationLayerDiv.querySelectorAll<HTMLAnchorElement>('a.internalLink').forEach((el) => {diff --git a/apps/web/src/features/block-pdf/component/DefinitionLookup/index.tsx b/apps/web/src/features/block-pdf/component/DefinitionLookup/index.tsxindex 251beb23b5..3383cc2904 100644--- a/apps/web/src/features/block-pdf/component/DefinitionLookup/index.tsx+++ b/apps/web/src/features/block-pdf/component/DefinitionLookup/index.tsx@@ -1,7 +1,3 @@-import {- zPopupViewer,- zViewerDefinitionLookup,-} from '@core/constant/stackingContext';import {autoUpdate,type ComputePositionReturn,@@ -241,7 +237,9 @@ export function DefinitionLookup(props: IProps) {ref={termRef}style={{...styles(),- 'z-index': zViewerDefinitionLookup + (isPopup ? zPopupViewer : 0),+ 'z-index': isPopup+ ? 'calc(var(--z-index-viewer-definition-lookup) + var(--z-index-popup-viewer))'+ : 'var(--z-index-viewer-definition-lookup)',}}><Card class="pinned-terms shadow-lg" isPinsWindow={props.isPinsWindow}>diff --git a/apps/web/src/features/channel/Media/MediaViewerDialog.tsx b/apps/web/src/features/channel/Media/MediaViewerDialog.tsxindex 35fba61dc1..6c204e89a0 100644--- a/apps/web/src/features/channel/Media/MediaViewerDialog.tsx+++ b/apps/web/src/features/channel/Media/MediaViewerDialog.tsx@@ -1,6 +1,5 @@import { Lightbox, LightboxToolbar } from '@core/component/Lightbox';-import * as stackingContext from '@core/constant/stackingContext';import { isMobile } from '@core/mobile/isMobile';import { Dialog } from '@kobalte/core/dialog';import ChevronLeftIcon from '@phosphor/caret-left.svg';@@ -87,7 +86,7 @@ function VideoViewerContent(props: {<Show when={props.indexLabel}><divclass="absolute top-4 left-4 rounded-lg border border-edge bg-surface px-3 py-1.5 shadow-md"- style={{ 'z-index': stackingContext.zModal + 1 }}+ style={{ 'z-index': 'calc(var(--z-index-modal) + 1)' }}><span class="text-sm font-medium text-ink">{props.indexLabel?.()}@@ -98,7 +97,7 @@ function VideoViewerContent(props: {<Show when={!isMobile() && !props.navigationHidden}><buttonclass={cn(navButtonClass, 'left-4')}- style={{ 'z-index': stackingContext.zModal + 1 }}+ style={{ 'z-index': 'calc(var(--z-index-modal) + 1)' }}onClick={props.onPrevious}disabled={!props.onPrevious}aria-label="Previous media"@@ -108,7 +107,7 @@ function VideoViewerContent(props: {<buttonclass={cn(navButtonClass, 'right-4')}- style={{ 'z-index': stackingContext.zModal + 1 }}+ style={{ 'z-index': 'calc(var(--z-index-modal) + 1)' }}onClick={props.onNext}disabled={!props.onNext}aria-label="Next media"diff --git a/apps/web/src/features/command/mobile/MobileSearch.tsx b/apps/web/src/features/command/mobile/MobileSearch.tsxindex bacf214139..5c3fcb2bae 100644--- a/apps/web/src/features/command/mobile/MobileSearch.tsx+++ b/apps/web/src/features/command/mobile/MobileSearch.tsx@@ -184,7 +184,7 @@ function MobileSearchInner() {return (<>{/* Full-frame results surface. Sits below the float host (see- zMobileSearch) so the input (dock region) and tabs (accessory+ --z-index-mobile-search) so the input (dock region) and tabs (accessoryregion) float over it; bottom padding clears that floating chrome. */}<Layer depth={0}><div class="fixed inset-0 z-mobile-search flex flex-col bg-surface pt-(--safe-top) pr-(--safe-right) pb-[calc(var(--virtual-keyboard-height)+var(--mobile-content-inset-bottom))] pl-(--safe-left)">diff --git a/apps/web/src/features/settings/Team.tsx b/apps/web/src/features/settings/Team.tsxindex 9644ce53eb..7464248f99 100644--- a/apps/web/src/features/settings/Team.tsx+++ b/apps/web/src/features/settings/Team.tsx@@ -124,7 +124,7 @@ function RoleSelect(props: {<CaretDownIcon class="size-3 text-ink-muted shrink-0" /></Select.Trigger><Select.Portal>- <Select.Content class="z-50 bg-surface ring ring-edge rounded shadow-lg min-w-25 p-1">+ <Select.Content class="z-action-menu bg-surface ring ring-edge rounded shadow-lg min-w-25 p-1"><Select.Listbox /></Select.Content></Select.Portal>diff --git a/apps/web/src/index.css b/apps/web/src/index.cssindex ed4fd74f54..30fcf246b3 100644--- a/apps/web/src/index.css+++ b/apps/web/src/index.css@@ -1,8 +1,7 @@@import "tailwindcss";-@plugin '../tailwind-plugins/zIndex.ts';-@source inline("{data-highlighted:}text-{comment,note,canvas,html,folder,email,code,pdf,image,write,chat,video,rss,calendar,contact,default},{tauri-ios:}{hidden}");+@source inline("z-{popup-viewer,viewer-definition-lookup}");@source './lib/core/component/LexicalMarkdown/theme.ts';@source '../**/*.tsx';@@ -219,13 +218,75 @@--animate-swipe-out: swipeOut 100ms ease-out;--animate-indeterminate-bar: indeterminate-bar 1.1s ease-in-out infinite;+ /* Z-index scale — the single source of truth for stacking. Classes come+ from these tokens (`--z-index-foo` -> `z-foo`).++ Bands:+ 0- 99 in-page — viewer internals (0-19), app chrome (20-30),+ floating widgets (90)+ 100-199 modal stack, drag previews, menus+ 200-299 always on top — tooltips, toasts++ Raw `z-{n}` classes are only for elements inside a local stacking+ context (an ancestor with its own z-index/isolate/transform), where the+ value is relative to siblings and can't leak into this scale. Anything+ stacking at page scope must use a token; don't add new raw page-scope+ values. For a component family with internal layering, wrap the family+ in one positioned `z-<token>` container: the wrapper slots the whole+ family into this scale, and the inner raw z-{n} values become contained,+ local ordering. */++ /* ---- 0-99: in-page --------------------------------------------------- */+ --z-index-main-view-layout: 0;+ --z-index-user-highlight: 1;+ --z-index-annotation-layer: 2;+ /* Split-view header title strip. Local to the header's own stacking+ context (Panel.Header is `z-split-panel-chrome` + relative), so a small+ value suffices. */+ --z-index-split-header-content: 3;+ --z-index-placeable: 4;+ --z-index-highlight-menu: 5;+ --z-index-viewer-definition-lookup: 6;+ --z-index-popup-viewer: 7;+ --z-index-simple-search: 8;+ --z-index-sign-up-banner: 18;+ --z-index-viewer-document-loading-spinner: 19;++ /* In-page app chrome (20-30). */+ /* Content-anchored floating controls (markdown table handles/menus/bars):+ above the content they annotate, below app chrome. They mount in the+ editor's local portal so its scroll and overflow clipping carry them+ under the split header with the content; the family layers internally+ with raw z-{n}. */+ --z-index-anchored-controls: 20;+ --z-index-item-options-menu: 22;+ /* Full-frame mobile search results sit below the mobile nav bar / float+ host, so the search input and category tabs float over them. */+ --z-index-mobile-search: 23;+ --z-index-mobile-nav-bar: 24;+ /* Split panel header/side-panel chrome: above the panel's content and the+ rest of the in-page chrome, below floating widgets. */+ --z-index-split-panel-chrome: 30;++ /* App-level floating widgets (`z-float`: draggable call controls, incoming+ calls). Above all other in-page content, below the modal stack. */+ --z-index-float: 90;++ /* ---- 100-199: modal stack, drag previews, menus ----------------------- */+ /* Anchored at 100 so nothing in-page can ever cover a modal. */--z-index-modal-overlay: 100;--z-index-modal: 110;--z-index-modal-content: 120;+ /* Drag previews render above whatever surface the drag started from. */+ --z-index-drag: 130;/* Dropdowns/popovers (`z-action-menu`). Above modal content so menus openedfrom inside a modal render on top of it, below tooltips. */--z-index-action-menu: 150;++ /* ---- 200-299: always on top ------------------------------------------ */--z-index-tool-tip: 200;+ /* The PDF custom cursor dot must never hide under a hover tooltip. */+ --z-index-custom-cursor-tooltip: 210;/* Toasts sit above everything (incl. full-screen modals) so they stay visible. */--z-index-toast-region: 250;diff --git a/apps/web/src/lib/core/comments/MeasureContainer.tsx b/apps/web/src/lib/core/comments/MeasureContainer.tsxindex 10233aa2f1..76ff123f0b 100644--- a/apps/web/src/lib/core/comments/MeasureContainer.tsx+++ b/apps/web/src/lib/core/comments/MeasureContainer.tsx@@ -1,4 +1,3 @@-import * as stackingContext from '@core/constant/stackingContext';import {createEffect,createMemo,@@ -71,7 +70,9 @@ export const MeasureContainer = (props: ParentProps<MeasureContainerProps>) => {top: `${props.top}px`,'max-height': props.maxHeight ? `${props.maxHeight}px` : undefined,'min-width': props.forceWidth ? `${props.forceWidth}px` : undefined,- 'z-index': stackingContext.zPlaceable + (props.isActive ? 1 : 0),+ 'z-index': props.isActive+ ? 'calc(var(--z-index-placeable) + 1)'+ : 'var(--z-index-placeable)',}}class="absolute w-full"ref={(el) => {diff --git a/apps/web/src/lib/core/component/AI/component/input/ChatAttachMenu.tsx b/apps/web/src/lib/core/component/AI/component/input/ChatAttachMenu.tsxindex eb92ecfa85..56da2a2365 100644--- a/apps/web/src/lib/core/component/AI/component/input/ChatAttachMenu.tsx+++ b/apps/web/src/lib/core/component/AI/component/input/ChatAttachMenu.tsx@@ -224,12 +224,12 @@ export function ChatAttachMenu(props: ChatAttachMenuProps) {return (<Show when={props.open}><div- class="fixed inset-0 bg-transparent z-99"+ class="fixed inset-0 bg-transparent z-action-menu"onClick={handleOverlayClick}onMouseDown={handleOverlayClick}><div- class="absolute z-full-page-modal-base"+ class="absolute"ref={setPopupRef}use:clickOutside={props.close}onKeyDown={handleKeyDown}diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/GenerateMenu.tsx b/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/GenerateMenu.tsxindex 91e2b4e8fd..e8952705c5 100644--- a/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/GenerateMenu.tsx+++ b/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/GenerateMenu.tsx@@ -157,7 +157,7 @@ function InnerGenerateMenu(props: GenerateMenuProps) {return (<ScopedPortal scope="local"><div- class="z-full-page-modal-base flex flex-col rounded-md -mt-7"+ class="z-action-menu flex flex-col rounded-md -mt-7"style={{width: targetWidth() + 'px',}}diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/plugins/blame-tooltip/BlameTooltip.tsx b/apps/web/src/lib/core/component/LexicalMarkdown/plugins/blame-tooltip/BlameTooltip.tsxindex 25969e449e..bb20682326 100644--- a/apps/web/src/lib/core/component/LexicalMarkdown/plugins/blame-tooltip/BlameTooltip.tsx+++ b/apps/web/src/lib/core/component/LexicalMarkdown/plugins/blame-tooltip/BlameTooltip.tsx@@ -82,7 +82,7 @@ export function BlameTooltip(props: {<Show when={visible() && query.data?.userId ? query.data : undefined}>{(b) => (<div- class="fixed z-50 rounded-md bg-surface px-2 py-1 text-xs text-ink-secondary/70 pointer-events-none"+ class="fixed z-tool-tip rounded-md bg-surface px-2 py-1 text-xs text-ink-secondary/70 pointer-events-none"style={{left: `${props.state.x + 12}px`,top: `${props.state.y + 12}px`,diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/plugins/find-and-replace/searchHighlight.tsx b/apps/web/src/lib/core/component/LexicalMarkdown/plugins/find-and-replace/searchHighlight.tsxindex 7f97aca9f7..d67ff1c4ea 100644--- a/apps/web/src/lib/core/component/LexicalMarkdown/plugins/find-and-replace/searchHighlight.tsx+++ b/apps/web/src/lib/core/component/LexicalMarkdown/plugins/find-and-replace/searchHighlight.tsx@@ -152,7 +152,7 @@ export function FloatingSearchHighlight({<divstyle={item.style}class={cn(- 'z-150 m-0 text-transparent h-4.5 absolute top-0 left-0 opacity-50 pointer-events-none',+ 'z-10 m-0 text-transparent h-4.5 absolute top-0 left-0 opacity-50 pointer-events-none',item.idx === FindAndReplaceStore.get.currentMatch + 1? 'bg-accent': 'bg-accent/50'diff --git a/apps/web/src/lib/core/component/Lightbox/LightboxChrome.tsx b/apps/web/src/lib/core/component/Lightbox/LightboxChrome.tsxindex d038a621a6..1090a19efe 100644--- a/apps/web/src/lib/core/component/Lightbox/LightboxChrome.tsx+++ b/apps/web/src/lib/core/component/Lightbox/LightboxChrome.tsx@@ -1,4 +1,3 @@-import * as stackingContext from '@core/constant/stackingContext';import { isMobile } from '@core/mobile/isMobile';import ChevronLeftIcon from '@phosphor/caret-left.svg';import ChevronRightIcon from '@phosphor/caret-right.svg';@@ -26,7 +25,7 @@ export function LightboxChrome(props: LightboxChromeProps) {<Show when={!props.navigationHidden}><buttonclass={cn(navButtonClass, 'left-4')}- style={{ 'z-index': stackingContext.zModal + 1 }}+ style={{ 'z-index': 'calc(var(--z-index-modal) + 1)' }}onClick={props.onPrevious}disabled={!props.onPrevious}aria-label="Previous image"@@ -36,7 +35,7 @@ export function LightboxChrome(props: LightboxChromeProps) {<buttonclass={cn(navButtonClass, 'right-4')}- style={{ 'z-index': stackingContext.zModal + 1 }}+ style={{ 'z-index': 'calc(var(--z-index-modal) + 1)' }}onClick={props.onNext}disabled={!props.onNext}aria-label="Next image"@@ -50,7 +49,7 @@ export function LightboxChrome(props: LightboxChromeProps) {<Show when={props.indexLabel}><divclass="absolute top-4 left-4 bg-surface backdrop-blur-sm rounded-lg border border-edge px-3 py-1.5 shadow-md transition-opacity duration-300"- style={{ 'z-index': stackingContext.zModal + 1 }}+ style={{ 'z-index': 'calc(var(--z-index-modal) + 1)' }}><span class="text-sm text-ink font-medium">{props.indexLabel?.()}diff --git a/apps/web/src/lib/core/component/Lightbox/LightboxToolbar.tsx b/apps/web/src/lib/core/component/Lightbox/LightboxToolbar.tsxindex b5cbe56e24..cb1756721e 100644--- a/apps/web/src/lib/core/component/Lightbox/LightboxToolbar.tsx+++ b/apps/web/src/lib/core/component/Lightbox/LightboxToolbar.tsx@@ -1,4 +1,3 @@-import * as stackingContext from '@core/constant/stackingContext';import { isMobile } from '@core/mobile/isMobile';import { cn } from '@ui';import type { JSX } from 'solid-js';@@ -17,7 +16,7 @@ export function LightboxToolbar(props: LightboxToolbarProps) {? 'opacity-100': 'opacity-0 pointer-events-none')}- style={{ 'z-index': stackingContext.zModal + 1 }}+ style={{ 'z-index': 'calc(var(--z-index-modal) + 1)' }}>{props.children}</div>diff --git a/apps/web/src/lib/core/constant/stackingContext.ts b/apps/web/src/lib/core/constant/stackingContext.tsdeleted file mode 100644index c7ed038664..0000000000--- a/apps/web/src/lib/core/constant/stackingContext.ts+++ /dev/null@@ -1,55 +0,0 @@-// based on https://www.smashingmagazine.com/2021/02/css-z-index-large-projects/--// Utils-const base = 0;-const above = 1; // use this for all values above the base--// Viewer Layout-export const zMainViewLayout = base;-export const zUserHighlight = above + zMainViewLayout;-export const zAnnotationLayer = above + zUserHighlight;-export const zPageOverlay = above + zAnnotationLayer;-export const zPlaceable = above + zPageOverlay;-// NOTE: not working properly due to floating portal moving element out of the stacking context-export const zPlaceableOptionsMenu = above + zPlaceable;-export const zHighlightMenu = zPlaceableOptionsMenu;-export const zViewerDefinitionLookup = above + zPlaceableOptionsMenu;-export const zPopupViewer = above + zViewerDefinitionLookup;-export const zSimpleSearch = above + zPopupViewer;-export const zSelectorMenu = above + zSimpleSearch;--// we add the popup viewer stacking context to the previous items because the popup viewer is a child of the viewer-// multiplying by 10 to ensure the following items are above the popup viewer and its children (I think this is handled by the z-index stacking context anyway)-export const zSignUpBanner = 10 * above + zSimpleSearch;-export const zViewerDocumentLoadingSpinner = above + zSignUpBanner;-export const zViewerNotificationModal = above + zSignUpBanner;--// Navigation Bars-export const zTopBarLayout = above + zViewerNotificationModal;-// NOTE: side panel is above top bar because editor top bar isn't resizing so we want to keep the side panel above it-export const zSidePanelLayout = above + zTopBarLayout; // Side Panel Layout (LHS Recent Files + RHS AI Side Panel)-export const zItemOptionsMenu = above + zSidePanelLayout;-export const zActionMenu = zItemOptionsMenu;-// Full-frame mobile search results: full-screen surface that sits below the-// mobile nav bar / float host, so the search input (dock region) and category-// tabs (accessory region) float over it.-export const zMobileSearch = above + zActionMenu;-export const zMobileNavBar = above + zMobileSearch;-export const zSidePanelSearchAndFilter = above + zMobileNavBar;--// Modal-export const zModalOverlay = above + zSidePanelSearchAndFilter;-export const zModal = above + zModalOverlay;-export const zModalContent = above + zModal;--export const zToastRegion = above + zModalContent;--// Full Page Modal (there can only be one at a time)-export const zFullPageModalBase = base + 100;--export const zCustomCursorTooltip = zFullPageModalBase + 100;--export const zDrag = zSidePanelLayout + 100;--// Tooltip should always be the highest z-index, yes?-export const zToolTip = zDrag + above;diff --git a/apps/web/tailwind-plugins/zIndex.ts b/apps/web/tailwind-plugins/zIndex.tsdeleted file mode 100644index dc929ec551..0000000000--- a/apps/web/tailwind-plugins/zIndex.ts+++ /dev/null@@ -1,26 +0,0 @@-import plugin from 'tailwindcss/plugin';-import * as stackingContext from '../src/lib/core/constant/stackingContext';--// Compute the key names once, at the top level-const zIndexKeys = Object.keys(stackingContext).map((key) =>- key- .slice(1)- .replace(/([a-z])([A-Z])/g, '$1-$2')- .toLowerCase()-);--// Create a mapping of computed keys to their original values-const zIndexValues = Object.fromEntries(- zIndexKeys.map((key, index) => [key, Object.values(stackingContext)[index]])-);--export default plugin(function ({ addUtilities }) {- const zIndexUtilities = Object.fromEntries(- zIndexKeys.map((key) => [- `.z-${key}`,- { zIndex: zIndexValues[key].toString() },- ])- );-- addUtilities(zIndexUtilities);-});