Skip to content

feat(toolbar): implement container queries - #8025

Open
srambach wants to merge 13 commits into
patternfly:mainfrom
srambach:7967-toolbar-container-query
Open

feat(toolbar): implement container queries#8025
srambach wants to merge 13 commits into
patternfly:mainfrom
srambach:7967-toolbar-container-query

Conversation

@srambach

@srambach srambach commented Dec 12, 2025

Copy link
Copy Markdown
Member

This adds container breakpoints and creates another set of breakpoint modifiers based on a toolbar container for each of the existing (media based) breakpoint modifiers.

Fixes #7967

Implemented with support from Claude and Cursor.

Summary by CodeRabbit

  • New Features
    • Toolbar now supports opt-in container-query responsiveness, enabling container-aware show/hide behavior and improved toggle-group breakpoint handling.
  • Documentation
    • Added detailed guidance and examples for container-query Toolbars, including breakpoint behavior, media- vs container-query comparisons, and troubleshooting notes.
  • Style
    • Introduced supporting container-query utilities and breakpoint variables, plus example styling hooks demonstrating resizeable/spacer container interactions.
  • Chores
    • Updated local ignore rules to ignore the .claude directory.

@coderabbitai

coderabbitai Bot commented Dec 12, 2025

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds opt-in container-query responsiveness for Toolbars through new Sass breakpoints and mixins, container-aware visibility and expandable-content rules, toggle-group handling, example styles, documentation, and a broader .gitignore rule.

Changes

Toolbar container-query responsiveness

Layer / File(s) Summary
Container context and visibility
src/patternfly/components/Toolbar/toolbar.scss, src/patternfly/sass-utilities/mixins.scss, src/patternfly/sass-utilities/scss-variables.scss
Adds container breakpoints and container-aware Sass utilities, and applies them to opt-in Toolbar container modifiers while preserving non-container behavior.
Expandable and toggle behavior
src/patternfly/components/Toolbar/toolbar.scss
Adds container-query rules for expandable content and toggle groups, plus a shared toggle-group breakpoint mixin.
Examples and documentation
src/patternfly/components/Toolbar/examples/Toolbar.css, src/patternfly/components/Toolbar/examples/Toolbar.md
Adds resize/spacer example selectors and documents Toolbar container-query modifiers, breakpoints, and behavior comparisons.
Claude directory ignore rule
.gitignore
Changes the ignore rule to exclude the entire /.claude directory.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Toolbar
  participant SassUtilities
  participant Container
  Toolbar->>Container: establish named inline-size context
  Toolbar->>SassUtilities: apply container breakpoint visibility rules
  SassUtilities-->>Toolbar: generate container-query styles
  Container-->>Toolbar: determine responsive content and toggle display
Loading

Possibly related issues

Possibly related PRs

Suggested labels: released on @prerelease``

Suggested reviewers: mcoker, jcmill

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The .gitignore change for the .claude directory is unrelated to the toolbar container-query work. Move the .gitignore update to a separate PR or remove it from this changeset.
✅ Passed checks (3 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 style and accurately summarizes the toolbar container-query work.
Linked Issues check ✅ Passed The PR adds toolbar container-query support and breakpoints, matching the #7967 objective.
✨ Finishing Touches
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch 7967-toolbar-container-query

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.

@patternfly-build

patternfly-build commented Dec 12, 2025

Copy link
Copy Markdown
Collaborator

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

Looks great! As we discussed offline:

  • Increasing the specificity of the existing hidden/visible/toggle-group rules to add .pf-v6-c-toolbar:not({container-class}) could have some unwanted side effects, so it would be great if we can leave the specificity as it is - it would be fine to increase under .pf-m-container if needed since that's an opt-in
  • Make sure any examples that show container queries have isBeta in the start of the hbs block
  • Run visual regressions just to make sure nothing else changed

I think it would probably be a good idea to run them against the react repo, too, since I think toggle group examples have markup changes based on breakpoints that the core examples won't show. If you want to take a stab, here's how I would do it:

  • Start the react dev server with its core package pointing to your core directory with the toolbar cq branch checked out
  • In backstop.config.js comment out the first line for fullscreenRoutes.
  • Add a new const fullscreenRoutes: [...] - the code for that is below
  • Change baseUrl to the react server port (localhost:8002)
  • Run that and if everything looks like it rendered OK (not checking for toolbar bugs), accept those screenshots.
  • Update the react repo to not point to your local core (just run a regular react dev server), and run the screenshot job again. That should give you a diff of the react toolbar examples with and without your branch changes.

That should be it? Here's the fullscreenRoutes array reference above

const fullscreenRoutes = [
  '/components/toolbar/react/toolbar-items',
  '/components/toolbar/react/with-adjusted-inset',
  '/components/toolbar/react/sticky-toolbar',
  '/components/toolbar/react/with-groups-of-items',
  '/components/toolbar/react/background-color-variants',
  '/components/toolbar/react/component-managed-toggle-groups',
  '/components/toolbar/react/consumer-managed-toggle-groups',
  '/components/toolbar/react/with-filters',
  '/components/toolbar/react/with-custom-label-group-content',
  '/components/toolbar/react/stacked-example',
  '/components/toolbar/react/toolbar-content-wrapping',
  '/components/toolbar/react/toolbar-group-spacers',
  '/components/toolbar/react/toolbar-item-spacers',
  '/components/toolbar/react-demos/console-log-viewer-toolbar-demo',
  '/components/data-list/react-demos/expandable-control-in-toolbar',
  '/components/table/react-demos/sticky-columns-and-header-with-toolbar'
];

@srambach
srambach force-pushed the 7967-toolbar-container-query branch from 91597f6 to 3c55e92 Compare December 23, 2025 21:40

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

Actionable comments posted: 4

📜 Review details

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

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 91597f6 and 3c55e92.

📒 Files selected for processing (6)
  • .gitignore
  • src/patternfly/components/Toolbar/examples/Toolbar.css
  • src/patternfly/components/Toolbar/examples/Toolbar.md
  • src/patternfly/components/Toolbar/toolbar.scss
  • src/patternfly/sass-utilities/mixins.scss
  • src/patternfly/sass-utilities/scss-variables.scss
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-12-17T15:25:08.994Z
Learnt from: srambach
Repo: patternfly/patternfly PR: 8030
File: src/patternfly/components/TreeView/tree-view.scss:441-445
Timestamp: 2025-12-17T15:25:08.994Z
Learning: In PatternFly TreeView component (src/patternfly/components/TreeView/tree-view.scss), the `.pf-m-disabled` modifier on list items affects only the visual appearance of node content (text and icons), but intentionally does not change the toggle button color. The toggle remains functional and visually distinct to indicate the item can still be expanded/collapsed.

Applied to files:

  • src/patternfly/components/Toolbar/toolbar.scss
🪛 markdownlint-cli2 (0.18.1)
src/patternfly/components/Toolbar/examples/Toolbar.md

560-560: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


561-561: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above

(MD022, blanks-around-headings)


561-561: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


622-622: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


737-737: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


741-741: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


759-759: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-upload
🔇 Additional comments (10)
.gitignore (1)

33-33: Clarify the purpose and content of .claude artifacts.

The addition of .claude to gitignore lacks context: what does this pattern match, when is it generated, and why must it be excluded from version control? Given that the PR explicitly credits AI-assisted tooling (Claude and Cursor), silently ignoring generated artifacts without documentation may obscure the provenance of code changes and complicate code review traceability.

Consider documenting the artifact's purpose (e.g., as a comment in .gitignore or in the PR description) or storing it in a standard location with explicit handling.

src/patternfly/components/Toolbar/examples/Toolbar.css (1)

83-97: LGTM! Clear demo styles for container query examples.

The resizable container and spacer styles effectively support the documentation examples. The 290px spacer width directly corresponds to the offset between viewport and container breakpoints, making the comparison examples intuitive.

src/patternfly/sass-utilities/scss-variables.scss (1)

81-96: LGTM! Well-structured container breakpoint variables.

The container breakpoint variables correctly implement the 290px offset from viewport breakpoints. The naming convention is consistent with existing breakpoint variables, and the map structure mirrors $pf-v6-global--breakpoint-name-map for symmetry.

src/patternfly/sass-utilities/mixins.scss (1)

220-271: LGTM! Well-designed dual-mode hidden/visible mixin.

The conditional branching cleanly separates container-query mode from media-query mode. Using the same class names (pf-m-hidden-on-*, pf-m-visible-on-*) for both modes ensures a consistent API for consumers, with the behavior determined by whether a container context is established.

src/patternfly/components/Toolbar/examples/Toolbar.md (1)

925-930: LGTM! Comprehensive modifier documentation.

The new container modifier documentation clearly explains the purpose and breakpoint values for each variant. The table format is consistent with existing modifier documentation.

src/patternfly/components/Toolbar/toolbar.scss (5)

101-106: LGTM! Clean exclusion pattern for container-modified toolbars.

Using :where(:not([class*="pf-m-container"])) effectively prevents double-application of hidden-visible behavior when container queries are in use, while maintaining zero specificity impact.


200-225: LGTM! Well-structured container context initialization.

The container query opt-in block:

  1. Establishes container context with container-type and container-name
  2. Sets sensible defaults for toggle groups (filters hidden, toggle visible)
  3. Applies container-aware pf-v6-hidden-visible mixin

This provides a clean foundation for container-based responsive behavior.


415-442: LGTM! Good refactor extracting toggle group behavior into a reusable mixin.

Extracting the show/hide logic into pf-v6-toolbar-toggle-group-breakpoint-behavior reduces duplication and makes the code more maintainable.


352-360: Verify expandable content default container breakpoint.

The selector :where(.pf-m-container:not([class*="pf-m-container-"])) targets .pf-m-container without an explicit breakpoint suffix, defaulting to lg. This aligns with the documentation stating that .pf-m-container defaults to the lg breakpoint (702px).


529-554: Clarify the .pf-m-container selector logic in toggle group container query rules.

The selector on lines 536-537 applies container query rules for the current $breakpoint in each loop iteration. However, the plain .pf-m-container selector (without the -{breakpoint} variant) is included in both selectors and will match in every iteration, generating rules for all breakpoints (sm, md, lg, xl, 2xl). The .pf-m-container-{breakpoint} variant, by contrast, only matches when $breakpoint equals that variant in a given iteration, so .pf-m-container-md only receives md-specific rules.

This differs from the expandable-content section which explicitly excludes variant classes using :not([class*="pf-m-container-"]) on the plain .pf-m-container selector. Either the toggle group code should follow the same pattern for consistency, or it should be documented why this behavior is acceptable (e.g., intentionally supporting all breakpoint modifiers on the plain variant).

Comment thread src/patternfly/components/Toolbar/examples/Toolbar.md
Comment thread src/patternfly/components/Toolbar/examples/Toolbar.md Outdated
Comment thread src/patternfly/components/Toolbar/examples/Toolbar.md Outdated
Comment thread src/patternfly/sass-utilities/mixins.scss
@srambach

Copy link
Copy Markdown
Member Author

Rebased and used :where() in the selectors to reduce specificity.

Regression tests run against a new baseline as created in #8039 look ok. Toolbar just shows new examples; others seem likely to be rendering. Let's recheck after the updated tests are merged. One to check is /components/masthead/html-demos/with-toggle-group-filters-expandable-content-expanded-mobile/

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
src/patternfly/sass-utilities/mixins.scss (1)

60-81: Container query mixin implementation looks solid.

The mixin correctly handles base cases, performs breakpoint lookups, and generates appropriate @container rules with optional named containers. The conditional logic for named vs. unnamed containers is well-structured.

Note: A past review already identified trailing whitespace on line 68 after the map-get statement.

📜 Review details

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

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3c55e92 and 8f85249.

📒 Files selected for processing (2)
  • src/patternfly/components/Toolbar/examples/Toolbar.md
  • src/patternfly/sass-utilities/mixins.scss
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
src/patternfly/components/Toolbar/examples/Toolbar.md

765-765: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-upload
🔇 Additional comments (2)
src/patternfly/sass-utilities/mixins.scss (1)

220-271: LGTM! Clean implementation of container query support.

The mixin correctly extends the existing hidden-visible pattern to support container queries through an optional parameter. The mutually exclusive if/else logic (lines 242-269) ensures that either container queries or media queries are generated, but never both, preventing conflicts. The implementation maintains backward compatibility by defaulting to media query mode when $container-name is null.

src/patternfly/components/Toolbar/examples/Toolbar.md (1)

931-936: LGTM! Complete documentation of container query modifiers.

The modifier table accurately documents all container query breakpoints and their pixel values, consistent with the detailed breakpoint documentation provided earlier in the file (lines 617-624).

Comment thread src/patternfly/components/Toolbar/examples/Toolbar.md
@srambach

srambach commented Jan 2, 2026

Copy link
Copy Markdown
Member Author

Ran React visual diffs as recommended - just one artifact difference.
https://drive.google.com/file/d/1Tne-uELvP3j1Dj0BzUmE3T_7o47IlNnc/view?usp=sharing

Note for future reference - in addition to the instructions above, I had to change one additional line in backstop.config.js
change: const relativeUrls = Object.keys(fullscreenRoutes);
to: const relativeUrls = fullscreenRoutes;

@github-actions

Copy link
Copy Markdown

This PR has been automatically marked as stale because it has not had activity in the last 60 days.

@github-actions github-actions Bot added the Stale label Mar 11, 2026
@srambach
srambach force-pushed the 7967-toolbar-container-query branch from 8f85249 to 840da26 Compare April 1, 2026 15:40
@mcoker
mcoker requested a review from jcmill April 2, 2026 14:12
@github-actions github-actions Bot removed the Stale label Apr 3, 2026
@github-actions

Copy link
Copy Markdown

This PR has been automatically marked as stale because it has not had activity in the last 60 days.

@github-actions github-actions Bot added the Stale label Jun 12, 2026
Comment thread src/patternfly/components/Toolbar/toolbar.scss Outdated
@github-actions github-actions Bot removed the Stale label Jul 18, 2026
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.

Toolbar - container queries

4 participants