Skip to content

fix(AppShell): apply navAreaStyle to header wrapper in all height modes - #2464

Merged
ernestt merged 4 commits into
mainfrom
navi/fix/appshell-header-bg-mismatch
Jun 4, 2026
Merged

ernestt merged 4 commits into
mainfrom
navi/fix/appshell-header-bg-mismatch

Conversation

@ernestt

@ernestt ernestt commented Jun 1, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The top nav and side nav render with subtly different background colors in the elevated variant (the default).

Root Cause

The sidenav panel always receives navAreaStyle (explicit --color-background-body):

<XDSLayoutPanel xstyle={[navAreaStyle, ...]}> // always applied

But the header wrapper only received a background in auto height mode:

stylex.props(isAuto && styles.headerSticky, isAuto && stickyBgStyle)
//           ^^^^^^                          ^^^^^^ — only in auto mode

In the default fill mode, the header wrapper was transparent — relying on the root shell's background showing through. The sidenav painted its own layer explicitly. This mismatch caused the browser to composite them differently (sub-pixel rendering, layer boundaries from isolation: isolate on the elevated content backdrop), producing a visible color seam.

Introduced across PR #597 (d0d8fca) which added navAreaStyle to the panel, and PR #615 (d0fda31) which only added it to the header in auto mode for sticky scroll opacity.

Fix

Apply navAreaStyle to the header wrapper unconditionally:

-stylex.props(isAuto && styles.headerSticky, isAuto && stickyBgStyle)
+stylex.props(navAreaStyle, isAuto && styles.headerSticky)

Both nav areas now paint their own background layer identically in all height modes.

Testing

  • ✅ All 33 AppShell unit tests pass
  • ✅ TypeScript typecheck clean
  • ✅ SYNC + package boundary checks pass

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jun 1, 2026
@vercel

vercel Bot commented Jun 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
xds-sandbox Ignored Ignored Jun 4, 2026 11:42pm

Request Review

@github-actions

github-actions Bot commented Jun 1, 2026 •

Copy link
Copy Markdown
Contributor

🚀 Vercel Preview Deployment

Status ✅ Deployed
Preview Open Preview
Commit d2a2735
Inspect Vercel Dashboard
Workflow View Logs

No authentication required — anyone with the link can view the preview.

@github-actions

github-actions Bot commented Jun 1, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

No new or modified components detected.

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@xds/core N/A 4.5KB 0B

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@ernestt
ernestt force-pushed the navi/fix/appshell-header-bg-mismatch branch from 8bb67f0 to 853bdb7 Compare June 1, 2026 20:39
@ernestt ernestt changed the title fix(AppShell): apply explicit background to header in all height modes fix(AppShell): give header surface background in elevated variant with both navs Jun 1, 2026
The elevated variant's root already paints --color-background-body. Both
the header and sidenav should be transparent, letting the root show
through — same as the section variant.

PR #597 (d0d8fca) grouped 'elevated' with 'wash' in the navAreaStyle
condition, giving both an explicit navAreaWash background. This was
unnecessary for elevated (root already has that color) and caused the
header/sidenav to paint on separate layers, which created subtle
rendering inconsistencies between the two nav areas.

Fix: remove 'elevated' from the navAreaStyle condition so both header
and sidenav are transparent. The stickyBgStyle fallback (for auto mode
scroll opacity) now correctly uses navAreaWash for elevated instead of
navAreaSurface.
@ernestt
ernestt force-pushed the navi/fix/appshell-header-bg-mismatch branch from 853bdb7 to d1f10ac Compare June 1, 2026 21:01
@ernestt ernestt changed the title fix(AppShell): give header surface background in elevated variant with both navs fix(AppShell): remove explicit navAreaStyle from elevated variant Jun 1, 2026
@josephfarina

josephfarina commented Jun 1, 2026 •

Copy link
Copy Markdown
Contributor

Both header render sites dropped isAuto && stickyBgStyle — intentional?

In auto height mode, the sticky header relied on stickyBgStyle for an opaque background so scrolling content doesn't show through. For wash/surface it's covered by navAreaStyle, but for elevated/section navAreaStyle is undefined, so the sticky header now has no bg while the sidenav still keeps stickyBgStyle. Looks like a possible scroll-bleed + asymmetry.

If that's not intended, re-adding it to both sites should cover it:

stylex.props(navAreaStyle, isAuto && styles.headerSticky, isAuto && stickyBgStyle)

The at-rest transparency fix itself looks right.

xdsClassName('app-shell-header', {variant}),
stylex.props(isAuto && styles.headerSticky, isAuto && stickyBgStyle),
stylex.props(
navAreaStyle,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we need to include it here? There were some issues I ran into some time ago around theming these for sticky. I think if it's not sticky we shouldn't need this extra style but curious what you ran into.

xdsClassName('app-shell-header', {variant}),
stylex.props(isAuto && styles.headerSticky, isAuto && stickyBgStyle),
stylex.props(
navAreaStyle,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

@cixzhang cixzhang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm wasn't sure if we needed these navAreaStyles so left some comments there. But overall looks good

The header wrapper only received a background in auto mode (via
stickyBgStyle for scroll opacity), while the sidenav panel always
received navAreaStyle. In fill mode (the default), the header was
transparent — relying on the root background showing through. This
caused a visible color mismatch between the top nav and side nav
in the elevated variant due to compositing layer differences.

Fix: apply navAreaStyle unconditionally to the header wrapper,
matching the sidenav panel. Both nav areas now paint their own
background layer identically in all height modes.

Introduced in PR #597 (d0d8fca) which added navAreaStyle to the
panel but only added it to the header for auto mode in PR #615.
@ernestt
ernestt force-pushed the navi/fix/appshell-header-bg-mismatch branch from d179b7e to f103d3a Compare June 2, 2026 21:09
@ernestt ernestt changed the title fix(AppShell): remove explicit navAreaStyle from elevated variant fix(AppShell): apply navAreaStyle to header wrapper in all height modes Jun 2, 2026
ernestt added 2 commits June 2, 2026 23:52
The docsite's translucent top-nav effect (backdrop-filter blur + 80%
transparent background) used bare .xds-top-nav and .xds-layout-header
selectors. These leaked into nested AppShells rendered inside component
examples and template previews, causing their top navs to get the
frosted glass treatment unintentionally.

Scope all affected rules with :not(.xds-app-shell .xds-app-shell) so
they only match the outermost (page-level) shell. Nested shells inside
the content area render with their normal opaque backgrounds.
The previous scoping put the nested-shell guard on the outer .xds-app-shell
(`.xds-app-shell:not(.xds-app-shell .xds-app-shell) > .xds-layout .xds-top-nav`),
but the trailing .xds-top-nav was an unrestricted descendant — a nested
AppShell's top nav is still a descendant of the outer layout, so the frost
leaked into component examples and templates.

Move the guard onto the styled element itself via
`:where(:not(.xds-app-shell .xds-app-shell *))`. Any nav with two AppShell
ancestors is excluded and keeps its solid navAreaStyle background, staying
seamless with its sidenav. :where() keeps specificity at (0,1,0) so the
home-page, nav-mode, and theme-preview overrides still win unchanged.
@ernestt
ernestt requested a review from imdreamrunner as a code owner June 4, 2026 23:41
@ernestt

ernestt commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up commit: the frosted top-nav scoping wasn't actually working.

Bug in the prior scoping: the guard was on the outer shell —
.xds-app-shell:not(.xds-app-shell .xds-app-shell) > .xds-layout .xds-top-nav — but the trailing .xds-top-nav was an unrestricted descendant. A nested AppShell's top nav is still a descendant of the outer layout, so the frost leaked into component examples/templates (and that's why the preview still showed the mismatched/frosted nav inside nested shells).

Fix: move the guard onto the styled element itself via :where(:not(.xds-app-shell .xds-app-shell *)). Any nav with two AppShell ancestors is excluded and keeps its solid navAreaStyle background, staying seamless with its sidenav. :where() keeps specificity at (0,1,0) so the home-page / nav-mode / theme-preview overrides still win unchanged.

Verified the selector matching with jsdom: old selector matched both outer + nested navs; new selector matches outer only (and a standalone TopNav like the theme-preview faux nav still frosts as intended).

@ernestt
ernestt merged commit 32327f9 into main Jun 4, 2026
21 checks passed
cixzhang pushed a commit that referenced this pull request Jun 21, 2026
…es (#2464)

* fix(AppShell): remove explicit navAreaStyle from elevated variant

The elevated variant's root already paints --color-background-body. Both
the header and sidenav should be transparent, letting the root show
through — same as the section variant.

PR #597 (d78a5d0) grouped 'elevated' with 'wash' in the navAreaStyle
condition, giving both an explicit navAreaWash background. This was
unnecessary for elevated (root already has that color) and caused the
header/sidenav to paint on separate layers, which created subtle
rendering inconsistencies between the two nav areas.

Fix: remove 'elevated' from the navAreaStyle condition so both header
and sidenav are transparent. The stickyBgStyle fallback (for auto mode
scroll opacity) now correctly uses navAreaWash for elevated instead of
navAreaSurface.

* fix(AppShell): apply navAreaStyle to header wrapper in all height modes

The header wrapper only received a background in auto mode (via
stickyBgStyle for scroll opacity), while the sidenav panel always
received navAreaStyle. In fill mode (the default), the header was
transparent — relying on the root background showing through. This
caused a visible color mismatch between the top nav and side nav
in the elevated variant due to compositing layer differences.

Fix: apply navAreaStyle unconditionally to the header wrapper,
matching the sidenav panel. Both nav areas now paint their own
background layer identically in all height modes.

Introduced in PR #597 (d78a5d0) which added navAreaStyle to the
panel but only added it to the header for auto mode in PR #615.

* fix(docsite): scope frosted top-nav CSS to outermost shell only

The docsite's translucent top-nav effect (backdrop-filter blur + 80%
transparent background) used bare .xds-top-nav and .xds-layout-header
selectors. These leaked into nested AppShells rendered inside component
examples and template previews, causing their top navs to get the
frosted glass treatment unintentionally.

Scope all affected rules with :not(.xds-app-shell .xds-app-shell) so
they only match the outermost (page-level) shell. Nested shells inside
the content area render with their normal opaque backgrounds.

* fix(docsite): correctly scope frosted top-nav to outermost AppShell

The previous scoping put the nested-shell guard on the outer .xds-app-shell
(`.xds-app-shell:not(.xds-app-shell .xds-app-shell) > .xds-layout .xds-top-nav`),
but the trailing .xds-top-nav was an unrestricted descendant — a nested
AppShell's top nav is still a descendant of the outer layout, so the frost
leaked into component examples and templates.

Move the guard onto the styled element itself via
`:where(:not(.xds-app-shell .xds-app-shell *))`. Any nav with two AppShell
ancestors is excluded and keeps its solid navAreaStyle background, staying
seamless with its sidenav. :where() keeps specificity at (0,1,0) so the
home-page, nav-mode, and theme-preview overrides still win unchanged.
cixzhang pushed a commit that referenced this pull request Jun 21, 2026
…es (#2464)

* fix(AppShell): remove explicit navAreaStyle from elevated variant

The elevated variant's root already paints --color-background-body. Both
the header and sidenav should be transparent, letting the root show
through — same as the section variant.

PR #597 (9237ea5) grouped 'elevated' with 'wash' in the navAreaStyle
condition, giving both an explicit navAreaWash background. This was
unnecessary for elevated (root already has that color) and caused the
header/sidenav to paint on separate layers, which created subtle
rendering inconsistencies between the two nav areas.

Fix: remove 'elevated' from the navAreaStyle condition so both header
and sidenav are transparent. The stickyBgStyle fallback (for auto mode
scroll opacity) now correctly uses navAreaWash for elevated instead of
navAreaSurface.

* fix(AppShell): apply navAreaStyle to header wrapper in all height modes

The header wrapper only received a background in auto mode (via
stickyBgStyle for scroll opacity), while the sidenav panel always
received navAreaStyle. In fill mode (the default), the header was
transparent — relying on the root background showing through. This
caused a visible color mismatch between the top nav and side nav
in the elevated variant due to compositing layer differences.

Fix: apply navAreaStyle unconditionally to the header wrapper,
matching the sidenav panel. Both nav areas now paint their own
background layer identically in all height modes.

Introduced in PR #597 (9237ea5) which added navAreaStyle to the
panel but only added it to the header for auto mode in PR #615.

* fix(docsite): scope frosted top-nav CSS to outermost shell only

The docsite's translucent top-nav effect (backdrop-filter blur + 80%
transparent background) used bare .xds-top-nav and .xds-layout-header
selectors. These leaked into nested AppShells rendered inside component
examples and template previews, causing their top navs to get the
frosted glass treatment unintentionally.

Scope all affected rules with :not(.xds-app-shell .xds-app-shell) so
they only match the outermost (page-level) shell. Nested shells inside
the content area render with their normal opaque backgrounds.

* fix(docsite): correctly scope frosted top-nav to outermost AppShell

The previous scoping put the nested-shell guard on the outer .xds-app-shell
(`.xds-app-shell:not(.xds-app-shell .xds-app-shell) > .xds-layout .xds-top-nav`),
but the trailing .xds-top-nav was an unrestricted descendant — a nested
AppShell's top nav is still a descendant of the outer layout, so the frost
leaked into component examples and templates.

Move the guard onto the styled element itself via
`:where(:not(.xds-app-shell .xds-app-shell *))`. Any nav with two AppShell
ancestors is excluded and keeps its solid navAreaStyle background, staying
seamless with its sidenav. :where() keeps specificity at (0,1,0) so the
home-page, nav-mode, and theme-preview overrides still win unchanged.
@cixzhang
cixzhang deleted the navi/fix/appshell-header-bg-mismatch branch June 21, 2026 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants