Skip to content

feat(Compass): remove background props, update structure#12408

Open
kmcfaul wants to merge 4 commits into
patternfly:mainfrom
kmcfaul:compass-bg
Open

feat(Compass): remove background props, update structure#12408
kmcfaul wants to merge 4 commits into
patternfly:mainfrom
kmcfaul:compass-bg

Conversation

@kmcfaul
Copy link
Copy Markdown
Contributor

@kmcfaul kmcfaul commented May 4, 2026

What: Closes #12389

Waiting on patternfly/patternfly#8356 to merge first.

Removes background props as those are now set via CSS globally along with theme.
Updates structure set new wrapping div around the outer Drawer.

Summary by CodeRabbit

  • Refactor

    • Compass no longer accepts per-instance background image props; backgrounds are configured globally via theme.
    • Renamed header wrapper prop from compassPanelProps to panelProps.
  • Documentation

    • Clarified that Compass background is theme-controlled and CompassHero is used for per-instance background/gradient customization.
  • Tests

    • Removed tests asserting per-instance background image behavior; remaining tests cover drawer and layout behaviors.
  • Demos

    • Updated demo layouts to use “glass” styled panels and adjusted scrolling/height behavior.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 4, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8f27e02f-fe1d-4f05-8aa2-a6d017b5fdec

📥 Commits

Reviewing files that changed from the base of the PR and between 1e26c6c and 641ce96.

📒 Files selected for processing (2)
  • packages/react-core/src/demos/Compass/examples/CompassDemo.tsx
  • packages/react-core/src/demos/Compass/examples/CompassDockDemo.tsx
✅ Files skipped from review due to trivial changes (1)
  • packages/react-core/src/demos/Compass/examples/CompassDockDemo.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/react-core/src/demos/Compass/examples/CompassDemo.tsx

Walkthrough

Compass drops backgroundSrcLight/backgroundSrcDark and related token imports, changes the inner wrapper to styles.compassContainer, and always renders an outer <div className={css(styles.compass, ...)} {...props}>. CompassMainHeader renames compassPanelPropspanelProps. Tests, docs, and demos updated.

Changes

Compass Background Configuration & Header Prop Rename

Layer / File(s) Summary
Imports & Props
packages/react-core/src/components/Compass/Compass.tsx
Removed background-image token imports and deleted backgroundSrcLight / backgroundSrcDark from CompassProps.
Core Implementation / Markup
packages/react-core/src/components/Compass/Compass.tsx
Inner content now uses styles.compassContainer; component no longer computes/merges inline background-image styles; component always returns an outer <div className={css(styles.compass, dock !== undefined && styles.modifiers.docked, className)} {...props}> and conditionally renders Drawer or compassContent inside.
Header Prop Rename
packages/react-core/src/components/Compass/CompassMainHeader.tsx
Renamed compassPanelPropspanelProps; CompassMainHeader now destructures and forwards panelProps when rendering title or toolbar paths.
Tests
packages/react-core/src/components/Compass/__tests__/Compass.test.tsx, packages/react-core/src/components/Compass/__tests__/CompassMainHeader.test.tsx
Removed assertions for inline CSS vars for removed background props; updated panel-prop forwarding tests to use panelProps.
Documentation
packages/react-core/src/components/Compass/examples/Compass.md
Docs now state <Compass> background is set via theme-level CSS variable; <Hero> inside <CompassHero> controls backgroundSrcLight/backgroundSrcDark and gradientLight/gradientDark.
Demos / Examples
packages/react-core/src/demos/Compass/examples/*
Demos updated to pass panelProps={{ isGlass: true }} and convert Panels to isPill isGlass, isScrollable, and isAutoHeight where applicable.

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly Related PRs

Suggested Reviewers

  • mcoker
  • thatblindgeye
  • wise-king-sullyman
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: removing background props from Compass and updating the DOM structure as stated in the PR objectives.
Linked Issues check ✅ Passed The PR meets all coding requirements from issue #12389: background props removed from CompassProps, DOM structure updated with outer wrapper div, and examples updated for background image configuration.
Out of Scope Changes check ✅ Passed All changes align with the PR objectives and linked issue #12389. Minor demo updates to use glass styling were requested by reviewers and are appropriately scoped.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@patternfly-build
Copy link
Copy Markdown
Collaborator

patternfly-build commented May 4, 2026

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/react-core/src/components/Compass/Compass.tsx`:
- Line 63: The component currently applies className and {...props} to
styles.compassContainer but the new outer root element uses styles.compass,
which breaks public behavior for id, data-*, style, ARIA attrs and root-level
class targeting; update the JSX in the Compass component so that className and
{...props} (and any conditional docked class logic referencing
styles.modifiers.docked) are passed to the outer element using styles.compass
instead of styles.compassContainer, leaving the inner compassContainer as a
purely presentational child.
- Line 63: The Compass component API removed the
backgroundSrcLight/backgroundSrcDark props but tests and demos still pass them;
update the usages in Compass.test.tsx and CompassDemo.tsx to match the new
Compass API by removing those props (or replacing them with the new background
prop if the component now accepts a single background property), ensuring calls
to the Compass component (symbol: Compass) no longer include backgroundSrcLight
or backgroundSrcDark so tests and typings compile.

In `@packages/react-core/src/components/Compass/examples/Compass.md`:
- Line 39: The docs incorrectly claim <CompassHero> supports
backgroundSrcLight/backgroundSrcDark/gradientLight/gradientDark props; update
the Compass.md content to remove references to those props and instead document
the supported approach: set the Compass background globally via the CSS variable
on html (or the theme-level background) and mention that <CompassHero> does not
accept those background props. Edit the paragraph referencing <Compass> and
<CompassHero> to state the correct configuration method and clarify that
customization is global via the html CSS variable rather than per-hero props.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 735252d6-d0eb-4109-9d7c-4f525f16cd9b

📥 Commits

Reviewing files that changed from the base of the PR and between ed21bd6 and 52b0cbb.

📒 Files selected for processing (2)
  • packages/react-core/src/components/Compass/Compass.tsx
  • packages/react-core/src/components/Compass/examples/Compass.md

Comment thread packages/react-core/src/components/Compass/Compass.tsx Outdated
Comment thread packages/react-core/src/components/Compass/examples/Compass.md Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/react-core/src/components/Compass/Compass.tsx`:
- Line 113: The Compass component applies the docked CSS when checking dock !==
undefined which mismatches the dock rendering that uses truthiness; update the
className expression in the Compass JSX (the line that calls css(styles.compass,
...)) to use the same truthy check as rendering (e.g., replace dock !==
undefined && styles.modifiers.docked with dock && styles.modifiers.docked or
!!dock && styles.modifiers.docked) so that the docked style is only applied when
the dock is actually rendered.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0bf73002-ad28-4ba0-ab13-6c1a8e545b23

📥 Commits

Reviewing files that changed from the base of the PR and between 52b0cbb and bae5877.

⛔ Files ignored due to path filters (1)
  • packages/react-core/src/components/Compass/__tests__/__snapshots__/Compass.test.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (2)
  • packages/react-core/src/components/Compass/Compass.tsx
  • packages/react-core/src/components/Compass/__tests__/Compass.test.tsx
💤 Files with no reviewable changes (1)
  • packages/react-core/src/components/Compass/tests/Compass.test.tsx

Comment thread packages/react-core/src/components/Compass/Compass.tsx Outdated
@mcoker
Copy link
Copy Markdown
Contributor

mcoker commented May 11, 2026

On the docked nav compass demo, can you make sure the panel that wraps the content has these props?

  • isScrolalble
  • isAutoHeight
  • isFullHeight
  • isGlass
    • Also apply isGlass to the <Panel> in the main header of this demo.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
packages/react-core/src/demos/Compass/examples/CompassDockDemo.tsx (1)

398-399: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Remove deprecated backgroundSrcDark and backgroundSrcLight props.

According to the PR objectives, background props should be removed from the Compass component as "background images are now set globally via CSS and theme." These props are still present in the demo and are inconsistent with the stated goals of this PR.

🔧 Proposed fix
  return (
    <Compass
      masthead={mobileMasthead}
      dock={dockContent}
      isDockExpanded={isDockExpanded}
      isDockTextExpanded={isDockTextExpanded}
      main={mainContent}
-     backgroundSrcDark="/assets/images/pf-background.svg"
-     backgroundSrcLight="/assets/images/pf-background.svg"
    />
  );
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/react-core/src/demos/Compass/examples/CompassDockDemo.tsx` around
lines 398 - 399, The CompassDockDemo usage still passes deprecated props
backgroundSrcDark and backgroundSrcLight to the Compass component; remove these
props from the JSX in CompassDockDemo (search for CompassDockDemo or the Compass
component instance in this file) so the component no longer supplies
backgroundSrcDark/backgroundSrcLight, relying on the global CSS/theme background
instead; ensure no other references or prop types in this file expect those
props and run a quick typecheck to catch any residual usages.
packages/react-core/src/demos/Compass/examples/CompassDemo.tsx (1)

184-186: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Remove deprecated backgroundSrcDark and backgroundSrcLight props.

According to the PR objectives, background props should be removed from the Compass component as "background images are now set globally via CSS and theme." These props are still present in the demo and are inconsistent with the stated goals of this PR.

🔧 Proposed fix
  return (
    <Compass
      header={headerContent}
      sidebarStart={sidebarStartContent}
      main={mainContent}
      sidebarEnd={sidebarEndContent}
      footer={footerContent}
-     backgroundSrcDark="/assets/images/pf-background.svg"
-     backgroundSrcLight="/assets/images/pf-background.svg"
    />
  );
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/react-core/src/demos/Compass/examples/CompassDemo.tsx` around lines
184 - 186, Remove the deprecated backgroundSrcDark and backgroundSrcLight props
from the Compass component usage in CompassDemo.tsx: locate the JSX for the
Compass demo (the component instance that currently includes
backgroundSrcDark="/assets/images/pf-background.svg" and
backgroundSrcLight="/assets/images/pf-background.svg") and delete those two
props so the component relies on global CSS/theme-managed backgrounds instead.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@packages/react-core/src/demos/Compass/examples/CompassDemo.tsx`:
- Around line 184-186: Remove the deprecated backgroundSrcDark and
backgroundSrcLight props from the Compass component usage in CompassDemo.tsx:
locate the JSX for the Compass demo (the component instance that currently
includes backgroundSrcDark="/assets/images/pf-background.svg" and
backgroundSrcLight="/assets/images/pf-background.svg") and delete those two
props so the component relies on global CSS/theme-managed backgrounds instead.

In `@packages/react-core/src/demos/Compass/examples/CompassDockDemo.tsx`:
- Around line 398-399: The CompassDockDemo usage still passes deprecated props
backgroundSrcDark and backgroundSrcLight to the Compass component; remove these
props from the JSX in CompassDockDemo (search for CompassDockDemo or the Compass
component instance in this file) so the component no longer supplies
backgroundSrcDark/backgroundSrcLight, relying on the global CSS/theme background
instead; ensure no other references or prop types in this file expect those
props and run a quick typecheck to catch any residual usages.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 093e0ea4-427c-47c2-bb47-a19ae5c1d794

📥 Commits

Reviewing files that changed from the base of the PR and between bae5877 and 1e26c6c.

⛔ Files ignored due to path filters (1)
  • packages/react-core/src/components/Compass/__tests__/__snapshots__/Compass.test.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (7)
  • packages/react-core/src/components/Compass/Compass.tsx
  • packages/react-core/src/components/Compass/CompassMainHeader.tsx
  • packages/react-core/src/components/Compass/__tests__/Compass.test.tsx
  • packages/react-core/src/components/Compass/__tests__/CompassMainHeader.test.tsx
  • packages/react-core/src/components/Compass/examples/Compass.md
  • packages/react-core/src/demos/Compass/examples/CompassDemo.tsx
  • packages/react-core/src/demos/Compass/examples/CompassDockDemo.tsx
💤 Files with no reviewable changes (1)
  • packages/react-core/src/components/Compass/tests/Compass.test.tsx
✅ Files skipped from review due to trivial changes (1)
  • packages/react-core/src/components/Compass/examples/Compass.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/react-core/src/components/Compass/Compass.tsx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compass - remove background image props, add background images to examples

3 participants