feat(compass): support for responsive docked nav#8330
Conversation
WalkthroughAdds Compass docked navigation support: new Changes
Sequence Diagram(s)(omitted) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ 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. Comment |
|
Preview: https://pf-pr-8330.surge.sh A11y report: https://pf-pr-8330-a11y.surge.sh |
There was a problem hiding this comment.
🧹 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-visiblevariants 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$mastheadSCSS variable instead of hardcoding thepf-v6-c-mastheadprefix.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
📒 Files selected for processing (10)
src/patternfly/components/Button/button.scsssrc/patternfly/components/Compass/compass-dock-main.hbssrc/patternfly/components/Compass/compass-dock.hbssrc/patternfly/components/Compass/compass.scsssrc/patternfly/components/Compass/examples/Compass.mdsrc/patternfly/components/Masthead/masthead.scsssrc/patternfly/components/MenuToggle/menu-toggle.scsssrc/patternfly/components/Nav/nav.scsssrc/patternfly/demos/Compass/examples/Compass.mdsrc/patternfly/demos/Page/page-template.hbs
There was a problem hiding this comment.
🧹 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 newcompass--dockedpartial.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
📒 Files selected for processing (11)
src/patternfly/components/Button/button.scsssrc/patternfly/components/Compass/compass-dock-main.hbssrc/patternfly/components/Compass/compass-dock.hbssrc/patternfly/components/Compass/compass.scsssrc/patternfly/components/Compass/examples/Compass.mdsrc/patternfly/components/Masthead/masthead.scsssrc/patternfly/components/MenuToggle/menu-toggle.scsssrc/patternfly/components/Nav/nav.scsssrc/patternfly/demos/Compass/compass--docked.hbssrc/patternfly/demos/Compass/examples/Compass.mdsrc/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
|
🎉 This PR is included in version 6.5.0-prerelease.78 🎉 The release is available on: Your semantic-release bot 📦🚀 |
fixes #8042
Link - https://pf-pr-8330.surge.sh/ai/generative-uis/compass/html-demos/docked/
Adds
.pf-v6-c-compass__dock-mainto mimic the page component dock. Otherwise it's identical to the docked page responsive.Summary by CodeRabbit
New Features
Improvements
Documentation