You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Port #1350 to dtq-dev-9-base: UFAL/Backport #1333: admin-sidebar gutter via CSS var (no logged-in reload shift)
For an authenticated user a hard reload shifted the whole page right by the
admin-sidebar width. The `.outer-wrapper` left gutter was produced by the
`@slideSidebarPadding` animation, whose width comes from `CSSVariableService`,
a browser-only store fed from `document.styleSheets`. On the server that store
is empty, so SSR emitted `style="padding-left: 0;"` and the browser resolved the
real width afterwards - hence the jump. Measured on dev-6 before this change:
<div _ngcontent-... class="outer-wrapper ng-tns-c4194216939-0 ng-trigger
ng-trigger-slideSidebarPadding" style="padding-left: 0;">
The gutter now comes from a CSS class - `ds-admin-sidebar-{hidden,unpinned,pinned}`,
derived from a small `sidebarPaddingState$` - whose `padding-left` resolves from
the `--ds-admin-sidebar-*` custom properties. Those are defined in the
render-blocking theme stylesheet (`--ds-admin-sidebar-fixed-element-width: 55px`,
`--ds-admin-sidebar-total-width: 305px` on dev-6), so CSS resolves the gutter
identically on the server and in the browser, with no hardcoded width and no
browser-only variable read. The pin/unpin slide is preserved by
`transition: padding-left 300ms`, gated behind `ds-admin-sidebar-animate`, which
`ngAfterViewInit` enables only after the first paint so the initial SSR->CSR
resolution never animates.
Adaptations to the v9 base (the source commit targets the 7.x root component):
* `.outer-wrapper` on 9-base already carries `[ngClass]="browserOsClasses…"`, a
vanilla-9 feature 7.x does not have. Angular allows one `[ngClass]` per
element, and overwriting it would silently drop `browser-firefox` /
`browser-firefox-windows`, which `_custom_variables.scss` uses. The two are
therefore merged into a single `outerWrapperClasses$` stream instead of
pasting the source's `[ngClass]="'ds-admin-sidebar-' + (…)"`. A unit test
guards the merge.
* the sidebar element is `<ds-admin-sidebar>` on v9, not
`<ds-themed-admin-sidebar>`; that context line is left as it is.
* the source's trailing-comma reformat of the `windowService` constructor
parameter is already present on 9-base, and `AfterViewInit` joins a
multi-line `@angular/core` import, so those two hunks are no-ops here.
`slideSidebarPadding` itself is deliberately left in
`src/app/shared/animations/slide.ts`: after this change it still has one
consumer, the `custom` theme's `file-section.component.ts`.
Two unit tests are added beyond the source commit, which ships none. The v9
`root.component.spec.ts` had a single `it('should create')` that cannot detect
this regression. Both new tests were proven load-bearing with negative controls
(see the PR description).
Source: 1321b8a (dtq-dev PR #1350)
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
0 commit comments