Skip to content

feat(Toolbar,OverflowMenu): support responsive height vis breakpoints#12347

Open
kmcfaul wants to merge 4 commits intopatternfly:mainfrom
kmcfaul:responsive-heights
Open

feat(Toolbar,OverflowMenu): support responsive height vis breakpoints#12347
kmcfaul wants to merge 4 commits intopatternfly:mainfrom
kmcfaul:responsive-heights

Conversation

@kmcfaul
Copy link
Copy Markdown
Contributor

@kmcfaul kmcfaul commented Apr 10, 2026

What: Closes #12335

Needs patternfly/patternfly#8295 to be pulled in when merged for styling

  • Adds visibilityAtHeight props to ToolbarItem, ToolbarGroup, ToolbarContent that allows visibility to be changed based on specific height breakpoints
  • Adds isVertical to OverflowMenu that changes the layout orientation for vertical toolbars/elements that use OverflowMenu
  • Adds examples for Toolbar and OverflowMenu

Some notes:
I changed the OverflowMenu container example to full page to allow enough height for the breakpoint to change.
I also added a warning for vertical OverflowMenus that the sm breakpoint won't do anything (it evaluates to 0 from the token and cannot be calc'd - in practice sm means that something is always visible/above the breakpoint for OverflowMenu).

Summary by CodeRabbit

  • New Features

    • Added vertical orientation support to OverflowMenu with height-based responsive behavior.
    • Added height-responsive visibility controls to Toolbar components (ToolbarContent, ToolbarGroup, ToolbarItem) for responsive show/hide behavior based on container height.
    • Introduced vertical Toolbar layout option with automatic height-based responsiveness.
  • Documentation

    • Added examples and guides for vertical OverflowMenu and Toolbar layouts.
    • Clarified width vs. height-based breakpoint behavior in component documentation.

@kmcfaul kmcfaul marked this pull request as draft April 10, 2026 17:13
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 10, 2026

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

This pull request introduces vertical orientation support to OverflowMenu with height-based breakpoint responsiveness and adds height-responsive visibility properties (visibilityAtHeight) to multiple Toolbar components. New example components demonstrate vertical implementations for both OverflowMenu and Toolbar.

Changes

Cohort / File(s) Summary
OverflowMenu Component
packages/react-core/src/components/OverflowMenu/OverflowMenu.tsx
Added optional isVertical prop; implemented handleResizeHeight for height-based breakpoint calculations using globalHeightBreakpoints and clientHeight; routes resize handling to orientation-specific methods; applies vertical CSS modifier conditionally.
OverflowMenu Examples
packages/react-core/src/components/OverflowMenu/examples/OverflowMenuSimpleVertical.tsx, packages/react-core/src/components/OverflowMenu/examples/OverflowMenuBreakpointOnContainerHeight.tsx
Added two new example components demonstrating basic vertical overflow menu and height-based breakpoint responsiveness with dynamic container height adjustment via slider.
OverflowMenu Documentation
packages/react-core/src/components/OverflowMenu/examples/OverflowMenu.md
Updated documentation to clarify width vs. height breakpoint behavior; added sections for "Vertical" and "Breakpoint on container height" examples.
Toolbar Components
packages/react-core/src/components/Toolbar/ToolbarContent.tsx, packages/react-core/src/components/Toolbar/ToolbarGroup.tsx, packages/react-core/src/components/Toolbar/ToolbarItem.tsx
Added visibilityAtHeight prop to each component; clarified visibility prop documentation to specify width breakpoints; implemented height-based breakpoint modifier computation using getVerticalBreakpoint from page context.
Toolbar Documentation & Examples
packages/react-core/src/components/Toolbar/examples/Toolbar.md, packages/react-core/src/components/Toolbar/examples/ToolbarVertical.tsx
Added "Vertical toolbar" documentation section describing height-responsive configuration; created new example component demonstrating vertical toolbar with visibilityAtHeight applied at group and item levels.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • mcoker
  • wise-king-sullyman
  • thatblindgeye
🚥 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 describes the main change: adding support for responsive height visibility breakpoints to Toolbar and OverflowMenu components.
Linked Issues check ✅ Passed All primary coding objectives from #12335 are met: visibilityAtHeight props added to Toolbar components [ToolbarItem, ToolbarGroup, ToolbarContent], isVertical prop added to OverflowMenu, and examples provided.
Out of Scope Changes check ✅ Passed All changes are directly aligned with the linked issue objectives; no out-of-scope modifications detected beyond the documented height breakpoint support and vertical OverflowMenu enhancements.
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

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 Apr 10, 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

Caution

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

⚠️ Outside diff range comments (1)
packages/react-core/src/components/OverflowMenu/OverflowMenu.tsx (1)

63-72: ⚠️ Potential issue | 🟠 Major

Recompute the breakpoint when isVertical or breakpoint props change.

handleResize() branches on isVertical (lines 79–86) to use either height or width calculations, but componentDidUpdate() only reruns the calculation when breakpointRef changes. Flipping isVertical after mount or changing the breakpoint prop leaves isBelowBreakpoint stale until a resize event fires.

Suggested fix
  componentDidUpdate(prevProps: Readonly<OverflowMenuProps>, prevState: Readonly<OverflowMenuState>): void {
    const reference = this.props.breakpointReference ? this.getBreakpointRef() : undefined;

    if (prevState.breakpointRef !== reference) {
      // To remove any previous observer/event listener from componentDidMount before adding a new one
      this.observer();
      this.setState({ breakpointRef: reference });
      this.observer = getResizeObserver(reference, this.handleResizeWithDelay);
      this.handleResize();
+    } else if (
+      prevProps.isVertical !== this.props.isVertical ||
+      prevProps.breakpoint !== this.props.breakpoint
+    ) {
+      this.handleResize();
     }
   }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/react-core/src/components/OverflowMenu/OverflowMenu.tsx` around
lines 63 - 72, componentDidUpdate currently only reacts to breakpointRef changes
and so flipping isVertical or changing breakpoint leaves isBelowBreakpoint
stale; update componentDidUpdate (in OverflowMenu) to also detect prop changes
(prevProps.isVertical !== this.props.isVertical || prevProps.breakpoint !==
this.props.breakpoint) and when they change recompute the reference if needed
(use this.getBreakpointRef() like you do when computing reference) and call
this.handleResize() (and reattach observer if the breakpointReference-related
ref changed using this.observer = getResizeObserver(...)). Ensure you still call
this.observer() to cleanup and setState/update breakpointRef when the
breakpointReference-derived ref changes, but always invoke handleResize() when
isVertical or breakpoint props change so isBelowBreakpoint is updated
immediately.
🤖 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/OverflowMenu/examples/OverflowMenuBreakpointOnContainerHeight.tsx`:
- Around line 63-64: The displayed label text is wrong: in
OverflowMenuBreakpointOnContainerHeight.tsx update the span with id
"overflowMenu-hasBreakpointOnContainer-height-slider-label" (and any adjacent
text) from "Current container width" to "Current container height" (and ensure
any related aria/accessible labels or variables referencing containerHeight
reflect "height" consistently); keep the existing id and variable
containerHeight unchanged.
- Line 78: The example is using height-based breakpoint props but never toggles
OverflowMenu to vertical mode; update the <OverflowMenu> instance (the one with
props breakpointReference={containerRef} breakpoint="sm") to also pass
isVertical so OverflowMenu uses clientHeight for breakpoints, and change the
slider label text currently reading "Current container width" (around the slider
at line ~63) to "Current container height" so the UI and docs match the
height-based example.

In `@packages/react-core/src/components/Toolbar/examples/ToolbarVertical.tsx`:
- Around line 20-29: The example uses width-based props but should use height
breakpoints: replace the width-based visibility props with height-aware ones by
changing ToolbarGroup's visibility to visibilityAtHeight and each ToolbarItem's
visibility to visibilityAtHeight (i.e., keep the same breakpoint keys/values but
use visibilityAtHeight on ToolbarGroup and the two ToolbarItem instances with
lg/md/default as shown); update any prop names in ToolbarGroup and ToolbarItem
to visibilityAtHeight so the example demonstrates height breakpoints correctly.

---

Outside diff comments:
In `@packages/react-core/src/components/OverflowMenu/OverflowMenu.tsx`:
- Around line 63-72: componentDidUpdate currently only reacts to breakpointRef
changes and so flipping isVertical or changing breakpoint leaves
isBelowBreakpoint stale; update componentDidUpdate (in OverflowMenu) to also
detect prop changes (prevProps.isVertical !== this.props.isVertical ||
prevProps.breakpoint !== this.props.breakpoint) and when they change recompute
the reference if needed (use this.getBreakpointRef() like you do when computing
reference) and call this.handleResize() (and reattach observer if the
breakpointReference-related ref changed using this.observer =
getResizeObserver(...)). Ensure you still call this.observer() to cleanup and
setState/update breakpointRef when the breakpointReference-derived ref changes,
but always invoke handleResize() when isVertical or breakpoint props change so
isBelowBreakpoint is updated immediately.
🪄 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: 4109d74c-080f-4724-9a72-c5cccf04a3cd

📥 Commits

Reviewing files that changed from the base of the PR and between 911223a and 08742ba.

📒 Files selected for processing (9)
  • packages/react-core/src/components/OverflowMenu/OverflowMenu.tsx
  • packages/react-core/src/components/OverflowMenu/examples/OverflowMenu.md
  • packages/react-core/src/components/OverflowMenu/examples/OverflowMenuBreakpointOnContainerHeight.tsx
  • packages/react-core/src/components/OverflowMenu/examples/OverflowMenuSimpleVertical.tsx
  • packages/react-core/src/components/Toolbar/ToolbarContent.tsx
  • packages/react-core/src/components/Toolbar/ToolbarGroup.tsx
  • packages/react-core/src/components/Toolbar/ToolbarItem.tsx
  • packages/react-core/src/components/Toolbar/examples/Toolbar.md
  • packages/react-core/src/components/Toolbar/examples/ToolbarVertical.tsx

Comment thread packages/react-core/src/components/Toolbar/examples/ToolbarVertical.tsx Outdated
@kmcfaul kmcfaul force-pushed the responsive-heights branch from 08742ba to fdd97ac Compare April 13, 2026 15:58
@kmcfaul kmcfaul marked this pull request as ready for review April 13, 2026 15:58
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 the current code and only fix it if needed.

Inline comments:
In `@packages/react-core/src/components/OverflowMenu/OverflowMenu.tsx`:
- Line 8: The import in OverflowMenu.tsx uses an absolute path for PickOptional
which is inconsistent with the project's relative import convention; change the
import of PickOptional to use the same relative path style as other helpers
(e.g., adjust the import statement referencing PickOptional in OverflowMenu.tsx
to the appropriate relative path such as ../../helpers or
../../helpers/typeUtils to match nearby files).
🪄 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: 545c30bc-6141-4039-bbd5-f785f11951ee

📥 Commits

Reviewing files that changed from the base of the PR and between 08742ba and fdd97ac.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (14)
  • packages/react-core/package.json
  • packages/react-core/src/components/OverflowMenu/OverflowMenu.tsx
  • packages/react-core/src/components/OverflowMenu/examples/OverflowMenu.md
  • packages/react-core/src/components/OverflowMenu/examples/OverflowMenuBreakpointOnContainerHeight.tsx
  • packages/react-core/src/components/OverflowMenu/examples/OverflowMenuSimpleVertical.tsx
  • packages/react-core/src/components/Toolbar/ToolbarContent.tsx
  • packages/react-core/src/components/Toolbar/ToolbarGroup.tsx
  • packages/react-core/src/components/Toolbar/ToolbarItem.tsx
  • packages/react-core/src/components/Toolbar/examples/Toolbar.md
  • packages/react-core/src/components/Toolbar/examples/ToolbarVertical.tsx
  • packages/react-docs/package.json
  • packages/react-icons/package.json
  • packages/react-styles/package.json
  • packages/react-tokens/package.json
✅ Files skipped from review due to trivial changes (7)
  • packages/react-docs/package.json
  • packages/react-tokens/package.json
  • packages/react-core/package.json
  • packages/react-icons/package.json
  • packages/react-styles/package.json
  • packages/react-core/src/components/OverflowMenu/examples/OverflowMenu.md
  • packages/react-core/src/components/Toolbar/examples/Toolbar.md
🚧 Files skipped from review as they are similar to previous changes (5)
  • packages/react-core/src/components/Toolbar/examples/ToolbarVertical.tsx
  • packages/react-core/src/components/Toolbar/ToolbarGroup.tsx
  • packages/react-core/src/components/Toolbar/ToolbarContent.tsx
  • packages/react-core/src/components/OverflowMenu/examples/OverflowMenuSimpleVertical.tsx
  • packages/react-core/src/components/Toolbar/ToolbarItem.tsx

Comment thread packages/react-core/src/components/OverflowMenu/OverflowMenu.tsx 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.

🧹 Nitpick comments (1)
packages/react-core/src/components/OverflowMenu/OverflowMenu.tsx (1)

79-116: Clean refactor with symmetric width/height handling.

The dispatch logic and handleResizeHeight implementation are well-structured. One edge case to consider: if isVertical changes dynamically after mount, isBelowBreakpoint won't recalculate until the next resize event occurs since componentDidUpdate only checks for breakpointRef changes.

If dynamic isVertical switching is a supported use case, consider adding a check in componentDidUpdate:

♻️ Optional enhancement
 componentDidUpdate(prevProps: Readonly<OverflowMenuProps>, prevState: Readonly<OverflowMenuState>): void {
   const reference = this.props.breakpointReference ? this.getBreakpointRef() : undefined;

-  if (prevState.breakpointRef !== reference) {
+  if (prevState.breakpointRef !== reference || prevProps.isVertical !== this.props.isVertical) {
     // To remove any previous observer/event listener from componentDidMount before adding a new one
     this.observer();
     this.setState({ breakpointRef: reference });
     this.observer = getResizeObserver(reference, this.handleResizeWithDelay);
     this.handleResize();
   }
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/react-core/src/components/OverflowMenu/OverflowMenu.tsx` around
lines 79 - 116, If isVertical can change at runtime, componentDidUpdate should
also detect a change in this.props.isVertical (compare prevProps.isVertical !==
this.props.isVertical) and trigger a recalculation of isBelowBreakpoint by
calling handleResize (or the appropriate handler: handleResizeWidth /
handleResizeHeight) so the state updates immediately when orientation switches;
update componentDidUpdate to include this check and call the same resize logic
used on window resize to keep isBelowBreakpoint in sync.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/react-core/src/components/OverflowMenu/OverflowMenu.tsx`:
- Around line 79-116: If isVertical can change at runtime, componentDidUpdate
should also detect a change in this.props.isVertical (compare
prevProps.isVertical !== this.props.isVertical) and trigger a recalculation of
isBelowBreakpoint by calling handleResize (or the appropriate handler:
handleResizeWidth / handleResizeHeight) so the state updates immediately when
orientation switches; update componentDidUpdate to include this check and call
the same resize logic used on window resize to keep isBelowBreakpoint in sync.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9ae93b45-9e22-4e8d-ad26-fc74e2687dce

📥 Commits

Reviewing files that changed from the base of the PR and between fdd97ac and 179cd4a.

📒 Files selected for processing (3)
  • packages/react-core/src/components/OverflowMenu/OverflowMenu.tsx
  • packages/react-core/src/components/OverflowMenu/examples/OverflowMenuBreakpointOnContainerHeight.tsx
  • packages/react-core/src/components/Toolbar/examples/ToolbarVertical.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/react-core/src/components/Toolbar/examples/ToolbarVertical.tsx
  • packages/react-core/src/components/OverflowMenu/examples/OverflowMenuBreakpointOnContainerHeight.tsx

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 the current code and only fix it if needed.

Inline comments:
In `@packages/react-core/src/components/Toolbar/examples/ToolbarVertical.tsx`:
- Around line 16-18: The example's label for ToolbarItem is inconsistent with
its visibilityAtHeight config: the prop visibilityAtHeight={{ default: 'hidden',
lg: 'visible' }} makes the item visible at the lg breakpoint, but the text says
"visible above md breakpoint." Update either the prop on the ToolbarItem or the
label text so they match; e.g., change the label to "Item 6 (visible at lg
breakpoint)" or change the visibilityAtHeight value to reflect "above md" (e.g.,
make it visible at md) — locate the ToolbarItem instance with the
visibilityAtHeight prop to apply the fix.
🪄 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: 5aabe15c-53ba-4d84-aa22-9028e87159c8

📥 Commits

Reviewing files that changed from the base of the PR and between 179cd4a and be35ea3.

📒 Files selected for processing (4)
  • packages/react-core/src/components/OverflowMenu/OverflowMenu.tsx
  • packages/react-core/src/components/OverflowMenu/examples/OverflowMenu.md
  • packages/react-core/src/components/OverflowMenu/examples/OverflowMenuBreakpointOnContainerHeight.tsx
  • packages/react-core/src/components/Toolbar/examples/ToolbarVertical.tsx
✅ Files skipped from review due to trivial changes (1)
  • packages/react-core/src/components/OverflowMenu/examples/OverflowMenu.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/react-core/src/components/OverflowMenu/examples/OverflowMenuBreakpointOnContainerHeight.tsx

Comment on lines +16 to +18
<ToolbarItem visibilityAtHeight={{ default: 'hidden', lg: 'visible' }}>
Item 6 (visible above md breakpoint)
</ToolbarItem>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Item 6 description conflicts with its breakpoint config.

Line 16 makes Item 6 visible at lg, but Line 17 says “visible above md breakpoint.” Please align the label (or the prop) so the example isn’t misleading.

Suggested fix (label aligned to current behavior)
-        <ToolbarItem visibilityAtHeight={{ default: 'hidden', lg: 'visible' }}>
-          Item 6 (visible above md breakpoint)
+        <ToolbarItem visibilityAtHeight={{ default: 'hidden', lg: 'visible' }}>
+          Item 6 (visible above lg breakpoint)
         </ToolbarItem>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<ToolbarItem visibilityAtHeight={{ default: 'hidden', lg: 'visible' }}>
Item 6 (visible above md breakpoint)
</ToolbarItem>
<ToolbarItem visibilityAtHeight={{ default: 'hidden', lg: 'visible' }}>
Item 6 (visible above lg breakpoint)
</ToolbarItem>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/react-core/src/components/Toolbar/examples/ToolbarVertical.tsx`
around lines 16 - 18, The example's label for ToolbarItem is inconsistent with
its visibilityAtHeight config: the prop visibilityAtHeight={{ default: 'hidden',
lg: 'visible' }} makes the item visible at the lg breakpoint, but the text says
"visible above md breakpoint." Update either the prop on the ToolbarItem or the
label text so they match; e.g., change the label to "Item 6 (visible at lg
breakpoint)" or change the visibilityAtHeight value to reflect "above md" (e.g.,
make it visible at md) — locate the ToolbarItem instance with the
visibilityAtHeight prop to apply the fix.

@kmcfaul kmcfaul force-pushed the responsive-heights branch from be35ea3 to dbb03c6 Compare April 21, 2026 17:07
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

Caution

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

⚠️ Outside diff range comments (1)
packages/react-core/src/components/Toolbar/ToolbarItem.tsx (1)

181-223: ⚠️ Potential issue | 🔴 Critical

Height visibility modifiers are missing from the CSS dependency—visibilityAtHeight will silently fail to apply modifiers.

The code calls formatBreakpointMods(visibilityAtHeight, styles, '', getVerticalBreakpoint(height), true) expecting CSS classes like hiddenOnMdHeight and visibleOnLgHeight, but these do not exist in the current @patternfly/react-styles or @patternfly/patternfly packages. The formatBreakpointMods function filters out missing modifier keys with .filter(Boolean), so components using visibilityAtHeight will render without responsive height-based visibility—no error is raised, just silent failure.

Although upstream PR patternfly/patternfly#8295 is merged, the height visibility classes have not yet landed in a published release. Before merge, either:

  • Confirm a new @patternfly/patternfly release with height modifiers is published and pinned, or
  • Run npm run generate in packages/react-styles to verify the workspace CSS contains the modifiers
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/react-core/src/components/Toolbar/ToolbarItem.tsx` around lines 181
- 223, ToolbarItem uses formatBreakpointMods(visibilityAtHeight, styles, '',
getVerticalBreakpoint(height), true) but the corresponding height-based modifier
classes are missing from styles, so visibilityAtHeight silently fails; fix by
ensuring the compiled CSS contains those modifiers—either update/pin the
`@patternfly/patternfly/`@patternfly/react-styles dependency to a release that
includes the height visibility classes or regenerate the local style bundle (run
the workspace style generation, e.g., npm run generate in the react-styles
package) so styles includes keys like hiddenOnMdHeight/visibleOnLgHeight
referenced by formatBreakpointMods; verify by checking styles object entries
used by ToolbarItem and formatBreakpointMods/getVerticalBreakpoint resolve to
non-empty class names.
🧹 Nitpick comments (1)
packages/react-core/src/components/OverflowMenu/OverflowMenu.tsx (1)

103-115: Consider keying the "sm" warning on the breakpoint name rather than === 0.

The early-return warning assumes any 0 pixel value corresponds to the sm breakpoint. This coupling is implicit: if another breakpoint token ever resolves to 0 (or sm changes), the warning text and the effective behavior drift. Gating the branch on breakpoint === 'sm' makes the intent self-documenting and robust to token changes:

♻️ Proposed refactor
   handleResizeHeight = () => {
-    const breakpointHeight = globalHeightBreakpoints[this.props.breakpoint];
-    if (breakpointHeight === 0) {
+    const { breakpoint } = this.props;
+    if (breakpoint === 'sm') {
       // eslint-disable-next-line no-console
       console.warn('The "sm" breakpoint does not apply to vertical overflow menus.');
       return;
     }
+    const breakpointHeight = globalHeightBreakpoints[breakpoint];

     if (!breakpointHeight) {
       // eslint-disable-next-line no-console
       console.error('OverflowMenu will not be visible without a valid breakpoint.');
       return;
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/react-core/src/components/OverflowMenu/OverflowMenu.tsx` around
lines 103 - 115, The warning in handleResizeHeight currently checks
breakpointHeight === 0 to detect the "sm" case, which couples logic to a token
value; change the guard to check the breakpoint name instead
(this.props.breakpoint === 'sm') so the intent is explicit and robust; locate
handleResizeHeight and globalHeightBreakpoints in OverflowMenu.tsx and replace
the breakpointHeight === 0 branch with a condition that checks
this.props.breakpoint === 'sm', keeping the warning text and early return
behavior otherwise preserving the existing subsequent validation for
missing/invalid breakpointHeight.
🤖 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/OverflowMenu/examples/OverflowMenuSimpleVertical.tsx`:
- Around line 36-41: The last OverflowMenuDropdownItem in
OverflowMenuSimpleVertical.tsx has a mismatched itemId (itemId={5}) skipping 4;
update the final OverflowMenuDropdownItem's itemId to 4 so the sequence matches
the preceding items (0..4) and aligns with the sibling example; locate the
OverflowMenuDropdownItem instances and change the unique symbol itemId value for
the last item from 5 to 4.

---

Outside diff comments:
In `@packages/react-core/src/components/Toolbar/ToolbarItem.tsx`:
- Around line 181-223: ToolbarItem uses formatBreakpointMods(visibilityAtHeight,
styles, '', getVerticalBreakpoint(height), true) but the corresponding
height-based modifier classes are missing from styles, so visibilityAtHeight
silently fails; fix by ensuring the compiled CSS contains those modifiers—either
update/pin the `@patternfly/patternfly/`@patternfly/react-styles dependency to a
release that includes the height visibility classes or regenerate the local
style bundle (run the workspace style generation, e.g., npm run generate in the
react-styles package) so styles includes keys like
hiddenOnMdHeight/visibleOnLgHeight referenced by formatBreakpointMods; verify by
checking styles object entries used by ToolbarItem and
formatBreakpointMods/getVerticalBreakpoint resolve to non-empty class names.

---

Nitpick comments:
In `@packages/react-core/src/components/OverflowMenu/OverflowMenu.tsx`:
- Around line 103-115: The warning in handleResizeHeight currently checks
breakpointHeight === 0 to detect the "sm" case, which couples logic to a token
value; change the guard to check the breakpoint name instead
(this.props.breakpoint === 'sm') so the intent is explicit and robust; locate
handleResizeHeight and globalHeightBreakpoints in OverflowMenu.tsx and replace
the breakpointHeight === 0 branch with a condition that checks
this.props.breakpoint === 'sm', keeping the warning text and early return
behavior otherwise preserving the existing subsequent validation for
missing/invalid breakpointHeight.
🪄 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: b45444ad-4b6c-44b1-ae4f-82a3522c321e

📥 Commits

Reviewing files that changed from the base of the PR and between be35ea3 and dbb03c6.

📒 Files selected for processing (9)
  • packages/react-core/src/components/OverflowMenu/OverflowMenu.tsx
  • packages/react-core/src/components/OverflowMenu/examples/OverflowMenu.md
  • packages/react-core/src/components/OverflowMenu/examples/OverflowMenuBreakpointOnContainerHeight.tsx
  • packages/react-core/src/components/OverflowMenu/examples/OverflowMenuSimpleVertical.tsx
  • packages/react-core/src/components/Toolbar/ToolbarContent.tsx
  • packages/react-core/src/components/Toolbar/ToolbarGroup.tsx
  • packages/react-core/src/components/Toolbar/ToolbarItem.tsx
  • packages/react-core/src/components/Toolbar/examples/Toolbar.md
  • packages/react-core/src/components/Toolbar/examples/ToolbarVertical.tsx
✅ Files skipped from review due to trivial changes (3)
  • packages/react-core/src/components/OverflowMenu/examples/OverflowMenu.md
  • packages/react-core/src/components/Toolbar/examples/ToolbarVertical.tsx
  • packages/react-core/src/components/Toolbar/examples/Toolbar.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/react-core/src/components/Toolbar/ToolbarContent.tsx
  • packages/react-core/src/components/Toolbar/ToolbarGroup.tsx

Comment on lines +36 to +41
<OverflowMenuDropdownItem itemId={3} key="item4" isShared>
Item 4
</OverflowMenuDropdownItem>,
<OverflowMenuDropdownItem itemId={5} key="item5" isShared>
Item 5
</OverflowMenuDropdownItem>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Inconsistent itemId sequence — itemId={5} skips 4.

The final dropdown item uses itemId={5} while the preceding items are 0..3. The value 4 is skipped. This is cosmetic but inconsistent with the sibling example OverflowMenuBreakpointOnContainerHeight.tsx (which correctly uses 0..4) and could surprise anyone relying on ids.

🩹 Proposed fix
-    <OverflowMenuDropdownItem itemId={5} key="item5" isShared>
+    <OverflowMenuDropdownItem itemId={4} key="item5" isShared>
       Item 5
     </OverflowMenuDropdownItem>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<OverflowMenuDropdownItem itemId={3} key="item4" isShared>
Item 4
</OverflowMenuDropdownItem>,
<OverflowMenuDropdownItem itemId={5} key="item5" isShared>
Item 5
</OverflowMenuDropdownItem>
<OverflowMenuDropdownItem itemId={3} key="item4" isShared>
Item 4
</OverflowMenuDropdownItem>,
<OverflowMenuDropdownItem itemId={4} key="item5" isShared>
Item 5
</OverflowMenuDropdownItem>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/react-core/src/components/OverflowMenu/examples/OverflowMenuSimpleVertical.tsx`
around lines 36 - 41, The last OverflowMenuDropdownItem in
OverflowMenuSimpleVertical.tsx has a mismatched itemId (itemId={5}) skipping 4;
update the final OverflowMenuDropdownItem's itemId to 4 so the sequence matches
the preceding items (0..4) and aligns with the sibling example; locate the
OverflowMenuDropdownItem instances and change the unique symbol itemId value for
the last item from 5 to 4.

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/OverflowMenu - responsive height breakpoints for show/hide

2 participants