In ProgressBughigh

[editor/lightbox]

#11Opened by Peter LangmacherFeb 10, 2026, 10:47 AM
PL
Peter Langmacher
3 days ago

The Side panel open button is inbisible when the lightbox is open in edit mode. z-index issue

1 Comment

S
SAL
3 days ago

**AI Analysis** (by Claude)

# Analysis for Issue #11: Side Panel Button Invisible in Lightbox Edit Mode

## 1. Root Cause Analysis

This is a **z-index layering issue** where the lightbox modal overlay is rendering above the side panel open button, making it inaccessible to users in edit mode. The lightbox component likely has a high z-index value that's interfering with the editor's UI controls.

The issue occurs because:

- Lightbox modal creates a full-screen overlay with high z-index

- Side panel trigger button has lower z-index than lightbox overlay

- No proper z-index hierarchy established between editor UI and modal components

## 2. Affected Files

Based on typical Next.js website builder structure, likely files involved:

```

src/

├── components/

│ ├── editor/

│ │ ├── SidePanel.tsx (or SidePanel/index.tsx)

│ │ ├── SidePanelButton.tsx

│ │ └── EditorLayout.tsx

│ ├── ui/

│ │ ├── Lightbox.tsx (or Modal/Lightbox.tsx)

│ │ └── Modal.tsx

│ └── gallery/

│ └── GalleryLightbox.tsx

├── styles/

│ └── globals.css (z-index utilities)

└── lib/

└── constants/

└── zIndex.ts (z-index scale definitions)

```

## 3. Resolution Approach

### Step 1: Establish Z-Index Scale

Create a centralized z-index system:

```typescript

// lib/constants/zIndex.ts

export const Z_INDEX = {

BASE: 1,

DROPDOWN: 1000,

STICKY: 1020,

FIXED: 1030,

MODAL_BACKDROP: 1040,

MODAL: 1050,

POPOVER: 1060,

TOOLTIP: 1070,

EDITOR_CONTROLS: 1080, // Ensure editor controls are above modals

NOTIFICATION: 1090

} as const;

```

### Step 2: Update Lightbox Component

```tsx

// components/ui/Lightbox.tsx

const Lightbox = ({ isOpen, onClose, children }) => {

return (

<div

className={`fixed inset-0 bg-black bg-opacity-75 transition-opacity ${

isOpen ? 'opacity-100' : 'opacity-0 pointer-events-none'

}`}

style={{ zIndex: Z_INDEX.MODAL_BACKDROP }}

onClick={onClose}

>

<div

className="relative w-full h-full flex items-center justify-center"

style={{ zIndex: Z_INDEX.MODAL }}

onClick={(e) => e.stopPropagation()}

>

{children}

</div>

</div>

);

};

```

### Step 3: Update Side Panel Button

```tsx

// components/editor/SidePanelButton.tsx

const SidePanelButton = ({ onClick, isVisible }) => {

return (

<button

className="fixed top-4 right-4 p-2 bg-blue-600 text-white rounded-lg shadow-lg hover:bg-blue-700 transition-colors"

style={{ zIndex: Z_INDEX.EDITOR_CONTROLS }}

onClick={onClick}

>

<MenuIcon className="w-5 h-5" />

</button>

);

};

```

### Step 4: Add Tailwind Z-Index Utilities

```css

/* styles/globals.css */

.z-editor-controls {

z-index: 1080;

}

.z-modal-backdrop {

z-index: 1040;

}

.z-modal {

z-index: 1050;

}

```

### Step 5: Update Editor Layout

Ensure proper portal rendering for modals:

```tsx

// components/editor/EditorLayout.tsx

import { createPortal } from 'react-dom';

const EditorLayout = ({ children }) => {

return (

<>

<div className="relative">

{children}

<SidePanelButton className="z-editor-controls" />

</div>

{/* Render lightbox in portal to control stacking */}

{typeof window !== 'undefined' &&

createPortal(

<Lightbox />,

document.body

)

}

</>

);

};

```

## 4. Complexity Estimate

**Simple** - This is a straightforward CSS z-index fix that requires:

- Creating z-index constants (15 min)

- Updating 2-3 component files (30 min)

- Testing across different scenarios (15 min)

- Total: ~1 hour

The fix is simple because it only involves CSS layering adjustments without complex logic changes.

## 5. Dependencies

- **Prerequisites:** None - this is an isolated styling fix

- **Potential Blockers:**

- Need to verify current lightbox implementation location

- May need to check if other modals/overlays have similar issues

- Ensure side panel button positioning works across different screen sizes

- **Testing Requirements:**

- Test lightbox functionality still works after z-index changes

- Verify side panel button remains accessible in all editor modes

- Check responsive behavior on mobile devices

## Additional Recommendations

1. Implement a global z-index management system to prevent future layering conflicts

2. Add data-testid attributes to components for easier testing

3. Consider using CSS custom properties for dynamic z-index management

4. Document the z-index hierarchy in component documentation

Sign in to comment on this issue.

1
vote
Status
In Progress
Priority
high
Type
bug
Created
Feb 10, 2026