Skip to content

feat(compass): support for responsive docked nav#8330

Merged
mcoker merged 5 commits into
patternfly:mainfrom
mcoker:issue-8042
Apr 24, 2026
Merged

feat(compass): support for responsive docked nav#8330
mcoker merged 5 commits into
patternfly:mainfrom
mcoker:issue-8042

Conversation

@mcoker

@mcoker mcoker commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

fixes #8042

Link - https://pf-pr-8330.surge.sh/ai/generative-uis/compass/html-demos/docked/

Adds .pf-v6-c-compass__dock-main to mimic the page component dock. Otherwise it's identical to the docked page responsive.

Summary by CodeRabbit

  • New Features

    • Compass dock gains a dedicated dock-main wrapper and responsive mobile slide-in behavior.
  • Improvements

    • New visual tokens for dock backgrounds, borders, and shadows; refined masthead and toggle behavior across breakpoints.
    • Buttons, menu toggle, nav and masthead visuals updated to better respect dock expanded/text-expanded states.
  • Documentation

    • Updated Compass usage docs and demos showcasing docked variants and new classes.

@coderabbitai

coderabbitai Bot commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

Adds Compass docked navigation support: new compass-dock-main partial and demo template, broadens multiple SCSS selectors to recognize Compass dock states, and implements dock-specific layout, variables, and masthead/hamburger behaviors for mobile-to-desktop dock transitions.

Changes

Cohort / File(s) Summary
Compass core & dock templates
src/patternfly/components/Compass/compass.scss, src/patternfly/components/Compass/compass-dock-main.hbs, src/patternfly/components/Compass/compass-dock.hbs
Adds dock CSS tokens/variables and styles for mobile fixed slide-in dock and desktop layout; introduces compass-dock-main partial and composes @partial-block into it from compass-dock.
Dock-aware SCSS selector expansions
src/patternfly/components/Button/button.scss, src/patternfly/components/Masthead/masthead.scss, src/patternfly/components/MenuToggle/menu-toggle.scss, src/patternfly/components/Nav/nav.scss
Broadened @at-root/docked selectors to match .pf-m-text-expanded when present on either .#{$page}__dock or .#{$compass}__dock (selector-only changes).
Demos & examples
src/patternfly/demos/Compass/examples/Compass.md, src/patternfly/components/Compass/examples/Compass.md, src/patternfly/demos/Compass/compass--docked.hbs
Replaces hand-authored dock demo with reusable compass--docked partial, documents .pf-v6-c-compass__dock-main, and adds docked demo partial producing deterministic IDs and variants for expanded/text-expanded states.
Page template masthead simplification
src/patternfly/demos/Page/page-template.hbs
Removes duplicated conditional and emits inline masthead markup for docked-masthead branch with same structure (toggle, brand, toolbar).

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

  • #8042 — Docked nav - responsive solution in Compass layout — PR implements mobile collapsed toggle, overlay-expanded dock, and desktop behavior described by the issue.
  • Bug - Docked Nav additional followups #8291 — Related dock selector broadening and Compass dock markup/CSS surface touched by this PR.

Possibly related PRs

Suggested labels

Needs design review

Suggested reviewers

  • thatblindgeye
  • jcmill
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title follows conventional commit format with 'feat(scope)' prefix and clearly describes the main change: adding responsive docked nav support to the Compass component.
Linked Issues check ✅ Passed The PR successfully implements all coding requirements from issue #8042: responsive docked nav with mobile collapse to toggle icon, text-expanded overlay behavior, and proper CSS/template structure matching the page component dock pattern.
Out of Scope Changes check ✅ Passed All changes are directly scoped to implementing responsive docked nav support in Compass: SCSS updates for dock styling, new Handlebars templates for dock/dock-main, selector broadening in related components, and documentation/demo updates.

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


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

patternfly-build commented Apr 22, 2026

Copy link
Copy Markdown
Collaborator

@mcoker mcoker marked this pull request as ready for review April 24, 2026 18:11

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (4)
src/patternfly/demos/Compass/examples/Compass.md (1)

210-228: Consider extracting the inline masthead into a shared partial.

This inline masthead markup is nearly identical to the one introduced in src/patternfly/demos/Page/page-template.hbs (lines 9-27). Extracting it into a reusable partial (e.g. inline-masthead-search) would reduce duplication and keep the two demos in sync as the docked-nav UX evolves.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/patternfly/demos/Compass/examples/Compass.md` around lines 210 - 228, The
inline masthead markup duplicated here should be extracted into a shared
Handlebars partial to avoid duplication; create a new partial (e.g.
inline-masthead-search) that contains the masthead block (including the
masthead, masthead-main, masthead-brand/masthead-logo, masthead-content,
toolbar/toolbar-content/toolbar-content-section, toolbar-item and the button
partial with its search icon and aria-label) and replace this inline block with
a call to that partial in Compass.md and the existing Page/page-template.hbs so
both demos reference the same shared partial.
src/patternfly/demos/Page/page-template.hbs (1)

9-27: Duplicated inline-masthead markup across Page and Compass demos.

The same inline masthead structure (main with toggle + brand/logo, plus a content section containing a static toolbar with a right-aligned search icon button) is now duplicated in src/patternfly/demos/Compass/examples/Compass.md (lines 210-228). Consider extracting into a shared partial so both demos stay in sync as docked-nav UX evolves.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/patternfly/demos/Page/page-template.hbs` around lines 9 - 27, Extract the
duplicated inline masthead block (the masthead with
masthead-main/masthead-brand/masthead-logo and the masthead-content containing a
static toolbar with toolbar-content-section/toolbar-item and the search button)
into a shared Handlebars partial (e.g., masthead-inline) and replace the inline
markup in both the Page demo and the Compass demo with a single partial include
({{> masthead-inline}}); update references to the unique symbols masthead,
masthead-main, masthead-brand, masthead-logo, masthead-content, toolbar,
toolbar-content-section, toolbar-item and button so both demos import and render
the new partial.
src/patternfly/components/Compass/compass.scss (2)

141-172: Hamburger/collapse state selectors look correct.

A quick note for future readers: the seemingly redundant enumeration at line 147 — :is(.#{$button}.pf-m-hamburger, .#{$button}.pf-m-hamburger:hover, .#{$button}.pf-m-hamburger:focus-visible) — is intentional. Because :is() takes the maximum specificity of its arguments, including the :hover/:focus-visible variants raises this rule's specificity to match the hover rule at line 143 so that source order (line 147 last) wins when the dock is expanded and the toggle is hovered. Consider adding a one-line comment here to prevent a future “simplification” from accidentally breaking this.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/patternfly/components/Compass/compass.scss` around lines 141 - 172, Add a
one-line clarifying comment above the selector using
:is(.#{$button}.pf-m-hamburger, .#{$button}.pf-m-hamburger:hover,
.#{$button}.pf-m-hamburger:focus-visible) (the rule that intentionally boosts
specificity to match the hover rule for .#{$masthead} .#{$masthead}__toggle
.#{$button}.pf-m-hamburger) stating that the hover/focus variants are included
to raise specificity so source order wins when the dock is expanded; place it
right above that selector in compass.scss so future maintainers don’t remove the
variants.

115-119: Use the $masthead SCSS variable instead of hardcoding the pf-v6-c-masthead prefix.

Elsewhere in this file the convention is to interpolate the component variable when writing its custom properties (e.g. line 230 --#{$panel}__main-body--PaddingBlockStart). Hardcoding --pf-v6-c-masthead-- couples this rule to the current prefix and drifts from the rest of the codebase.

♻️ Proposed change
     > .#{$masthead} {
-      --pf-v6-c-masthead--BackgroundColor: var(--#{$compass}--m-docked__masthead--BackgroundColor);
-  
+      --#{$masthead}--BackgroundColor: var(--#{$compass}--m-docked__masthead--BackgroundColor);
+
       grid-area: header;
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/patternfly/components/Compass/compass.scss` around lines 115 - 119,
Replace the hardcoded custom property name that uses the "pf-v6-c-masthead"
prefix with the interpolated component variable; in the .#{$masthead} rule
change the custom property key from --pf-v6-c-masthead--BackgroundColor to use
interpolation (e.g. --#{$masthead}--BackgroundColor) so it follows the
convention used elsewhere (see $masthead and $compass in this file) and keeps
the RHS var(...) reference intact.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/patternfly/components/Compass/compass.scss`:
- Around line 141-172: Add a one-line clarifying comment above the selector
using :is(.#{$button}.pf-m-hamburger, .#{$button}.pf-m-hamburger:hover,
.#{$button}.pf-m-hamburger:focus-visible) (the rule that intentionally boosts
specificity to match the hover rule for .#{$masthead} .#{$masthead}__toggle
.#{$button}.pf-m-hamburger) stating that the hover/focus variants are included
to raise specificity so source order wins when the dock is expanded; place it
right above that selector in compass.scss so future maintainers don’t remove the
variants.
- Around line 115-119: Replace the hardcoded custom property name that uses the
"pf-v6-c-masthead" prefix with the interpolated component variable; in the
.#{$masthead} rule change the custom property key from
--pf-v6-c-masthead--BackgroundColor to use interpolation (e.g.
--#{$masthead}--BackgroundColor) so it follows the convention used elsewhere
(see $masthead and $compass in this file) and keeps the RHS var(...) reference
intact.

In `@src/patternfly/demos/Compass/examples/Compass.md`:
- Around line 210-228: The inline masthead markup duplicated here should be
extracted into a shared Handlebars partial to avoid duplication; create a new
partial (e.g. inline-masthead-search) that contains the masthead block
(including the masthead, masthead-main, masthead-brand/masthead-logo,
masthead-content, toolbar/toolbar-content/toolbar-content-section, toolbar-item
and the button partial with its search icon and aria-label) and replace this
inline block with a call to that partial in Compass.md and the existing
Page/page-template.hbs so both demos reference the same shared partial.

In `@src/patternfly/demos/Page/page-template.hbs`:
- Around line 9-27: Extract the duplicated inline masthead block (the masthead
with masthead-main/masthead-brand/masthead-logo and the masthead-content
containing a static toolbar with toolbar-content-section/toolbar-item and the
search button) into a shared Handlebars partial (e.g., masthead-inline) and
replace the inline markup in both the Page demo and the Compass demo with a
single partial include ({{> masthead-inline}}); update references to the unique
symbols masthead, masthead-main, masthead-brand, masthead-logo,
masthead-content, toolbar, toolbar-content-section, toolbar-item and button so
both demos import and render the new partial.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 89f35354-b9f7-488c-9c20-bf5f42ecf033

📥 Commits

Reviewing files that changed from the base of the PR and between f4f0266 and 492ddf4.

📒 Files selected for processing (10)
  • src/patternfly/components/Button/button.scss
  • src/patternfly/components/Compass/compass-dock-main.hbs
  • src/patternfly/components/Compass/compass-dock.hbs
  • src/patternfly/components/Compass/compass.scss
  • src/patternfly/components/Compass/examples/Compass.md
  • src/patternfly/components/Masthead/masthead.scss
  • src/patternfly/components/MenuToggle/menu-toggle.scss
  • src/patternfly/components/Nav/nav.scss
  • src/patternfly/demos/Compass/examples/Compass.md
  • src/patternfly/demos/Page/page-template.hbs

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (1)
src/patternfly/demos/Compass/examples/Compass.md (1)

206-224: LGTM — demo sections correctly exercise all four Expanded/TextExpanded combinations via the new compass--docked partial.

Optional nit: the surrounding sections (e.g., Dashboard, With drawer) include a short descriptive paragraph between the heading and the code fence. Consider adding a one-line description to each of the four new "Docked nav ..." sections so readers know what each variant demonstrates (mobile-collapsed vs. expanded-on-mobile vs. text-expanded overlay). Not blocking.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/patternfly/demos/Compass/examples/Compass.md` around lines 206 - 224, Add
a one-line descriptive sentence under each of the four "Docked nav" headings to
explain what the example demonstrates (e.g., mobile collapsed vs
expanded-on-mobile vs text-expanded vs text-expanded+mobile-expanded); update
the relevant examples that call the compass--docked partial
(compass--docked--id="compass-docked-example",
"compass-docked-mobile-expanded-example",
"compass-docked-text-expanded-example",
"compass-docked-text-expanded-mobile-expanded-example") and mention the key
flags used (compass-dock--IsExpanded and compass-dock--IsTextExpanded) so
readers immediately understand the variant shown.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/patternfly/demos/Compass/examples/Compass.md`:
- Around line 206-224: Add a one-line descriptive sentence under each of the
four "Docked nav" headings to explain what the example demonstrates (e.g.,
mobile collapsed vs expanded-on-mobile vs text-expanded vs
text-expanded+mobile-expanded); update the relevant examples that call the
compass--docked partial (compass--docked--id="compass-docked-example",
"compass-docked-mobile-expanded-example",
"compass-docked-text-expanded-example",
"compass-docked-text-expanded-mobile-expanded-example") and mention the key
flags used (compass-dock--IsExpanded and compass-dock--IsTextExpanded) so
readers immediately understand the variant shown.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 3d41a861-8ff1-4c97-9f36-98617f80e445

📥 Commits

Reviewing files that changed from the base of the PR and between 492ddf4 and 275574a.

📒 Files selected for processing (11)
  • src/patternfly/components/Button/button.scss
  • src/patternfly/components/Compass/compass-dock-main.hbs
  • src/patternfly/components/Compass/compass-dock.hbs
  • src/patternfly/components/Compass/compass.scss
  • src/patternfly/components/Compass/examples/Compass.md
  • src/patternfly/components/Masthead/masthead.scss
  • src/patternfly/components/MenuToggle/menu-toggle.scss
  • src/patternfly/components/Nav/nav.scss
  • src/patternfly/demos/Compass/compass--docked.hbs
  • src/patternfly/demos/Compass/examples/Compass.md
  • src/patternfly/demos/Page/page-template.hbs
✅ Files skipped from review due to trivial changes (3)
  • src/patternfly/demos/Page/page-template.hbs
  • src/patternfly/components/Compass/examples/Compass.md
  • src/patternfly/components/Compass/compass.scss
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/patternfly/components/Nav/nav.scss

@jcmill jcmill 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.

🤘

@mcoker mcoker merged commit e60f589 into patternfly:main Apr 24, 2026
5 checks passed
@mcoker mcoker deleted the issue-8042 branch April 24, 2026 20:28
@patternfly-build

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 6.5.0-prerelease.78 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docked nav - responsive solution in Compass layout

5 participants