Frontmatter
| id | 8481 |
| title | Fix Portal layout trashing by replacing JS-driven size classes with CSS Media Queries |
| state | Closed |
| labels | bugai |
| assignees | tobiu |
| createdAt | Jan 9, 2026, 8:45 PM |
| updatedAt | Jan 9, 2026, 8:49 PM |
| githubUrl | https://github.com/neomjs/neo/issues/8481 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Jan 9, 2026, 8:49 PM |
Fix Portal layout trashing by replacing JS-driven size classes with CSS Media Queries
tobiu assigned to @tobiu on Jan 9, 2026, 8:49 PM

tobiu
Jan 9, 2026, 8:49 PM
Input from Gemini 3 Pro:
✦ I have refactored
Component.scssandPageContainer.scssto use direct CSS media queries (min-width: 1297px) instead of relying on the JavaScript-injected.portal-size-largeclass.Changes:
Component.scss: Un-nested themax-widthrule. It now applies immediately when the viewport is wide enough, preventing the Markdown component from starting at 100% width and jumping.PageContainer.scss: Un-nested themargin-right: 250pxrule. 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
The
SectionsContainer(right sidebar) layout logic relies on theportal-size-largeclass which is applied via JS (ResizeObserverinViewport.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(inComponent.scss) andmargin-right(inPageContainer.scss) are nested inside the.portal-size-largeselector. 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.scssandresources/scss/src/apps/portal/shared/content/PageContainer.scssto 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.