LearnNewsExamplesServices
Frontmatter
id8481
titleFix Portal layout trashing by replacing JS-driven size classes with CSS Media Queries
stateClosed
labels
bugai
assigneestobiu
createdAtJan 9, 2026, 8:45 PM
updatedAtJan 9, 2026, 8:49 PM
githubUrlhttps://github.com/neomjs/neo/issues/8481
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJan 9, 2026, 8:49 PM

Fix Portal layout trashing by replacing JS-driven size classes with CSS Media Queries

Closed v11.19.1 bugai
tobiu
tobiu commented on Jan 9, 2026, 8:45 PM

The SectionsContainer (right sidebar) layout logic relies on the portal-size-large class which is applied via JS (ResizeObserver in Viewport.mjs). This causes a race condition (layout trashing) on page load where the content initially renders at full width before snapping to the correct width (minus the 250px sidebar).

Root Cause: The CSS rules for max-width (in Component.scss) and margin-right (in PageContainer.scss) are nested inside the .portal-size-large selector. This class is only applied after the Viewport initializes and measures its size in the worker, causing a visual jump.

Fix: Refactor resources/scss/src/apps/portal/shared/content/Component.scss and resources/scss/src/apps/portal/shared/content/PageContainer.scss to use the direct media query @media (min-width: 1297px) instead of relying on the JS-injected class. This ensures the layout is correct immediately upon first paint.

tobiu added the bug label on Jan 9, 2026, 8:45 PM
tobiu added the ai label on Jan 9, 2026, 8:45 PM
tobiu referenced in commit c76eee3 - "fix: Resolve Portal layout trashing by replacing JS-driven size classes with CSS Media Queries (#8481)" on Jan 9, 2026, 8:49 PM
tobiu assigned to @tobiu on Jan 9, 2026, 8:49 PM
tobiu
tobiu Jan 9, 2026, 8:49 PM

Input from Gemini 3 Pro:

✦ I have refactored Component.scss and PageContainer.scss to use direct CSS media queries (min-width: 1297px) instead of relying on the JavaScript-injected .portal-size-large class.

Changes:

  1. Component.scss: Un-nested the max-width rule. It now applies immediately when the viewport is wide enough, preventing the Markdown component from starting at 100% width and jumping.
  2. PageContainer.scss: Un-nested the margin-right: 250px rule. This ensures the content container reserves space for the fixed sidebar immediately during the first paint.

This resolves the layout trashing issue where the content would visually snap after the JS resize observer fired.

The changes have been pushed to dev.

tobiu closed this issue on Jan 9, 2026, 8:49 PM