4.3 KiB
MyUIbrix Responsive & Full-Width Fix
Date: October 21, 2025
Status: ✅ FIXED
Problem Summary
The MyUIbrix editor had critical layout issues:
- Not 100% width - Viewport wrapper was constrained by Chakra Container's
maxW="container.xl"(~1280px) - Not responsive - Width constraints prevented full-width editing on desktop
- Navigation z-index issues - Navbar was appearing "above" or "weird" relative to the editor overlay
- Container padding - Chakra Container padding was interfering with full-width layout
Root Cause
The MyUIbrix viewport wrapper was being created inside the Chakra <Container maxW="container.xl" py={8}> component from MainLayout.tsx, which:
- Limited width to ~1280px maximum
- Added padding that prevented full-width elements
- Created z-index conflicts with the sticky navbar
Solution Applied
1. Target Chakra Container Directly
Modified MyUIbrixEditor.tsx to detect and handle the Chakra Container:
const chakraContainer = document.querySelector('.chakra-container');
const mainContent = chakraContainer || document.querySelector('main') || document.body;
2. Remove Container Constraints
When MyUIbrix activates, we:
- Save original
maxWidthandpaddingas data attributes - Set
maxWidth: 'none',padding: '0',width: '100%' - Restore original values when editor closes
3. Full-Width Viewport Wrapper
Viewport wrapper now has:
width: 100%;
max-width: 100%;
z-index: 1; /* Below navbar (z-index: 1000) */
4. Proper Z-Index Management
- Navbar:
zIndex={1000}(sticky at top) - MyUIbrix Toolbar:
zIndex={9999}(fixed at top, above everything) - Viewport Wrapper:
z-index: 1(below navbar, box-shadow doesn't cover nav)
5. Cleanup on Exit
When editor closes:
- Restore Chakra Container's
maxWidthandpadding - Remove viewport wrapper
- Reset all inline styles
Files Modified
/frontend/src/components/editor/MyUIbrixEditor.tsx
Lines 1193-1239 - Viewport wrapper creation:
- Detects Chakra Container
- Removes Container constraints
- Sets proper z-index
- Ensures full-width behavior
Lines 1240-1270 - Cleanup on editor close:
- Restores Container styles
- Removes wrapper
- Cleans up data attributes
Lines 1272-1301 - Effect cleanup function:
- Same restoration logic
- Ensures no lingering styles
Lines 1314-1330 - Viewport size changes:
- Maintains
z-index: 1 - Applies responsive scaling for mobile/tablet
- Preserves full-width on desktop
Testing Checklist
- Desktop viewport: Full 100% width
- Mobile viewport: 375px width with proper scaling
- Tablet viewport: 768px width with proper scaling
- Navbar visible and functional above editor
- Toolbar visible and functional above navbar
- Container styles restored on editor close
- No layout shift when entering/exiting editor
- Box-shadow overlay doesn't cover navbar
- All sections editable and draggable
- Responsive on all screen sizes
Technical Details
Z-Index Hierarchy (Top to Bottom)
9999- MyUIbrix Toolbar (fixed)1000- Navbar (sticky)1- Viewport Wrapper (relative)
Width Behavior
- Desktop Mode:
width: 100%- full viewport width - Tablet Mode:
width: 768px+ scale transform - Mobile Mode:
width: 375px+ scale transform
Container Override
The Chakra Container's inline styles are temporarily overridden:
// Before
<Container maxW="container.xl" py={8}>
// During MyUIbrix (inline styles)
<Container style="max-width: none; padding: 0; width: 100%;">
// After (restored)
<Container maxW="container.xl" py={8}>
Performance Impact
- Minimal - Only applies when admin activates editor
- No impact on normal page visitors
- Smooth transitions (0.3s) when entering/exiting editor
- No layout thrashing - batch style updates
Browser Compatibility
- ✅ Chrome/Edge (Chromium)
- ✅ Firefox
- ✅ Safari
- ✅ Mobile browsers
Related Documentation
MYUIBRIX_PERFECT_FINAL.md- Overall MyUIbrix implementationMYUIBRIX_CRITICAL_FIXES.md- DOM manipulation fixesMYUIBRIX_FIXES_SUMMARY.md- Previous bug fixes
Status
PRODUCTION READY ✅
The MyUIbrix editor now provides a true full-width, responsive editing experience with proper z-index management and no layout conflicts with the navigation system.