Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@srambach
Copy link
Member

@srambach srambach commented Dec 16, 2025

Fixes #7996

Adds .pf-m-disabled to the tree view list item to change the appearance.
Note: Actions should be disabled separately.
Also, the compact version with a background color has further reduced contrast of disabled items, so it may not be desirable to use these options together.

Note: I added some disabled items for ease of testing - we can remove them if needed.
See it here:
basic tree view
compact
compact no background
With icons, then add pf-m-compact to see that, then add pf-m-no-background to see that version.

Summary by CodeRabbit

  • New Features

    • TreeView items and expansion toggles support a disabled state; visuals and interactions reflect disabled styling and non-interactivity across base, compact, no-background, and nested contexts.
    • Disabled toggles render and behave as non-interactive so disabled nodes cannot be expanded or collapsed.
  • Documentation

    • Examples and docs updated to show the disabled modifier and revised example labels indicating disabled items.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 16, 2025

Walkthrough

Adds disabled-state support for TreeView: examples mark nodes and toggles as disabled; Handlebars templates emit pf-m-disabled on nodes and toggles and disabled attributes on toggle controls when applicable; SCSS introduces and propagates disabled color custom properties across base, compact, nested, and no-background variants.

Changes

Cohort / File(s) Summary
Documentation / Examples
src/patternfly/components/TreeView/examples/TreeView.md
Examples updated to mark multiple nodes and toggles as disabled, adjust display text to indicate disabled items, and add pf-m-disabled mapping entries in documentation.
Base template
src/patternfly/components/TreeView/tree-view--base.hbs
Two tree-view-node partial invocations now pass tree-view-node--IsDisabled="true" (one also passes tree-view-node-toggle--IsDisabled="true"); some node labels updated to indicate disabled state.
Node template
src/patternfly/components/TreeView/tree-view-node.hbs
Adds conditional pf-m-disabled modifier on nodes when tree-view-node--IsDisabled is true.
Toggle template
src/patternfly/components/TreeView/tree-view-node-toggle.hbs
Root classes include pf-m-disabled when IsDisabled is true and the toggle emits a disabled attribute for toggle branches; preserves existing modifier logic.
Styling
src/patternfly/components/TreeView/tree-view.scss
Adds CSS custom properties for disabled state (node, node-icon, node-toggle) including nested, compact, and no-background variants; maps and propagates m-disabled and m-disabled__*-nested variables into compact/nested/no-background contexts.

Sequence Diagram(s)

(omitted β€” changes are template and styling updates without multi-component sequential flow)

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related issues

  • #7996 β€” TreeView - disabled styling for TreeViewListItem elements: adds modifier and toggle disabled styling for TreeView items; this PR implements pf-m-disabled classes and toggle disabled attributes addressing that objective.
  • Tree view disabled items follow upΒ #8053: touches TreeView node/toggle disabled-state handling and SCSS variables similar to changes here; likely related.
πŸš₯ 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 Title follows conventional commit format (feat: prefix) and clearly describes the feature to add disabled appearance styling to TreeView list items.
Linked Issues check βœ… Passed All coding objectives from issue #7996 are met: disabled-state styling for TreeView nodes and toggles is implemented via pf-m-disabled modifier applied to node, node-toggle, and related elements.
Out of Scope Changes check βœ… Passed All changes directly support the disabled styling objective; example nodes are added for testing and documentation is updated accordingly without introducing unrelated modifications.

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


πŸ“œ Recent 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 2c48279 and 3684f4e.

πŸ“’ Files selected for processing (1)
  • src/patternfly/components/TreeView/tree-view-node-toggle.hbs
🧰 Additional context used
🧠 Learnings (2)
πŸ““ Common learnings
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.
πŸ“š 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/TreeView/tree-view-node-toggle.hbs
⏰ 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 (1)
src/patternfly/components/TreeView/tree-view-node-toggle.hbs (1)

1-12: LGTM! Clean implementation of disabled state for the node toggle.

The changes correctly handle the disabled state:

  • The pf-m-disabled class is applied to the root element for visual styling.
  • The native disabled attribute is appropriately scoped within the IsToggle block, ensuring it only applies to <button> elements (not <span> placeholders).

This aligns with the PR objective to support disabled tree view elements and correctly separates the toggle-specific disabled state from the list-item-level disabled styling described in the learnings.


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
Collaborator

patternfly-build commented Dec 16, 2025

Copy link

@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

🧹 Nitpick comments (2)
src/patternfly/components/TreeView/examples/TreeView.md (1)

992-992: Consider adding a visual example section for the disabled modifier.

While the table entry is clear, all other modifiers in this file include visual code examples (e.g., "With checkboxes", "With icons"). A visual example section demonstrating .pf-m-disabled would help developers understand how to apply the modifier and what it looks like in practice.

src/patternfly/components/TreeView/tree-view.scss (1)

437-440: Consider suppressing hover/focus states on disabled items.

Currently, lines 539-544 apply hover and focus-within styles to all .#{$tree-view}__content elements. Disabled items will still show these interactive states, which creates confusing UX since disabled items should appear non-interactive.

Consider adding a rule to prevent hover/focus effects on disabled items:

+ .pf-m-disabled > .#{$tree-view}__content:hover,
+ .pf-m-disabled > .#{$tree-view}__content:focus-within {
+   --#{$tree-view}__node--BorderWidth: var(--#{$tree-view}__node--BorderWidth);
+   
+   background-color: var(--#{$tree-view}__node--BackgroundColor);
+ }

Alternatively, you could set the cursor to indicate non-interactivity:

+ .pf-m-disabled > .#{$tree-view}__content {
+   cursor: not-allowed;
+ }
πŸ“œ Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 9ff524e and 70f521e.

πŸ“’ Files selected for processing (2)
  • src/patternfly/components/TreeView/examples/TreeView.md (1 hunks)
  • src/patternfly/components/TreeView/tree-view.scss (2 hunks)
⏰ 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 (1)
src/patternfly/components/TreeView/tree-view.scss (1)

97-99: LGTM: Disabled color variables are well-defined.

The CSS variables follow proper naming conventions and use appropriate global design tokens for the disabled state.

@srambach srambach requested review from kmcfaul and mcoker December 16, 2025 14:26
Copy link

@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

πŸ“œ Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 5fcccd9 and 540a149.

πŸ“’ Files selected for processing (2)
  • src/patternfly/components/TreeView/examples/TreeView.md (3 hunks)
  • src/patternfly/components/TreeView/tree-view.scss (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/patternfly/components/TreeView/examples/TreeView.md
🧰 Additional context used
🧠 Learnings (2)
πŸ““ Common learnings
Learnt from: srambach
Repo: patternfly/patternfly PR: 8030
File: src/patternfly/components/TreeView/tree-view.scss:441-445
Timestamp: 2025-12-17T15:25:03.046Z
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.
πŸ“š Learning: 2025-12-17T15:25:03.046Z
Learnt from: srambach
Repo: patternfly/patternfly PR: 8030
File: src/patternfly/components/TreeView/tree-view.scss:441-445
Timestamp: 2025-12-17T15:25:03.046Z
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/TreeView/tree-view.scss
⏰ 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 (3)
src/patternfly/components/TreeView/tree-view.scss (3)

97-104: LGTM! Disabled color variables are well-structured.

The disabled-state color variables are properly defined using appropriate design tokens. The distinction between regular disabled colors (lines 98-99) and "on-disabled" colors for compact nested contexts (lines 101, 103) correctly reflects that compact mode uses background colors.


310-310: LGTM! Compact mode color propagation is correct.

These additions properly propagate colors to nested node containers and icons in compact mode. The variables inherit by default and are overridden to disabled colors when the .pf-m-disabled modifier is present (lines 451-452).

Also applies to: 319-322


448-453: LGTM! Disabled state propagation is correctly implemented.

The selector properly targets nodes within disabled list items, and the variable assignments correctly propagate disabled colors to node content, node icons, and compact mode variants. Based on learnings, the toggle icon color is intentionally not modified since the toggle functionality remains active even in the disabled visual state.

@mcoker
Copy link
Contributor

mcoker commented Dec 17, 2025

Looks like there is a stylelint error

src/patternfly/components/TreeView/tree-view.scss
  102:3  βœ–  Unexpected empty line before custom property  custom-property-empty-line-before

Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

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

Left a comment about inherit on some vars.

I'm curious why the modifier is on the list-item and not the node? Looks like you'll always have to target direct child node since list-items contain nested list-items and nodes, and this isn't intended to be inherited. Nodes will never have nested anything in them, so you could style the children classes without descendent selectors. Also looks like the node is what supports .pf-m-selectable and .pf-m-current, so might make sense if that is also the item that is disabled.

Also looks like the original issue mentions toggle icons should support being disabled, but I didn't see that here.

And is this the correct color for default compact (with backgrounds) disabled nodes?

Image Image

Comment on lines 363 to 364
--#{$tree-view}--m-compact__node-container--m-disabled--nested--Color: inherit;
--#{$tree-view}--m-compact__node-icon--m-disabled--nested--Color: inherit;
Copy link
Contributor

Choose a reason for hiding this comment

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

inherit on a CSS var inherits the var - doesn't apply the value inherit for the property it's applied to. To get the value inherit, what we typically do is something like this

--pf-c-component--Color: black;
--pf-c-component--m-inherit-color--Color: initial;

color: var(--pf-c-component--Color, inherit);

&.pf-m-inherit-color {
  --pf-c-component--Color: var(--pf-c-component--m-inherit-color--Color);
}

This is probably working because it's an invalid var and any color it's used on will break and revert to the initial value which is inherit.

Copy link
Contributor

Choose a reason for hiding this comment

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

In the react PR, I've put temporary 'pf-m-disabled' classes on the treeViewNode when the tree view node is a button (specifically, when selection and toggling for a node isn't separated), and on the treeViewNodeText and treeViewNodeToggle for when the behaviors are separate.

So we would want styling for those three use cases, though disabling the toggle button individually was something I had added myself, since the initial issue was more geared towards disabling the selection behavior for split behavior tree view nodes.

Copy link

@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: 2

♻️ Duplicate comments (1)
src/patternfly/components/TreeView/tree-view.scss (1)

363-364: Apply the same fix for no-background variant.

These lines have the same inherit issue as lines 186 and 188. In the no-background context, there's no background color, so reverting to standard disabled colors (not "on-disabled" variants) makes sense.

πŸ”Ž Apply this diff to fix the no-background variant:
   &.pf-m-no-background {
     --#{$tree-view}--m-compact__node-container--nested--BackgroundColor: var(--#{$tree-view}--m-no-background__node-container--BackgroundColor);
-    --#{$tree-view}--m-compact__node-container--m-disabled--nested--Color: inherit;
-    --#{$tree-view}--m-compact__node-icon--m-disabled--nested--Color: inherit;
+    --#{$tree-view}--m-compact__node-container--m-disabled--nested--Color: var(--pf-t--global--text--color--disabled);
+    --#{$tree-view}--m-compact__node-icon--m-disabled--nested--Color: var(--pf-t--global--icon--color--disabled);
   }

In this case, using the standard disabled tokens directly is more appropriate than the initial pattern, since there's no background to provide "on-disabled" contrast.

πŸ“œ Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 48ffe68 and e6de81a.

πŸ“’ Files selected for processing (3)
  • src/patternfly/components/TreeView/examples/TreeView.md (3 hunks)
  • src/patternfly/components/TreeView/tree-view--base.hbs (2 hunks)
  • src/patternfly/components/TreeView/tree-view.scss (6 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/patternfly/components/TreeView/examples/TreeView.md
🧰 Additional context used
🧠 Learnings (2)
πŸ““ Common learnings
Learnt from: srambach
Repo: patternfly/patternfly PR: 8030
File: src/patternfly/components/TreeView/tree-view.scss:441-445
Timestamp: 2025-12-17T15:25:03.046Z
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.
πŸ“š Learning: 2025-12-17T15:25:03.046Z
Learnt from: srambach
Repo: patternfly/patternfly PR: 8030
File: src/patternfly/components/TreeView/tree-view.scss:441-445
Timestamp: 2025-12-17T15:25:03.046Z
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/TreeView/tree-view.scss
  • src/patternfly/components/TreeView/tree-view--base.hbs
⏰ 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/components/TreeView/tree-view--base.hbs (1)

33-42: LGTMβ€”clear demonstration of the disabled state.

The addition of pf-m-disabled modifiers at both root and nested levels effectively demonstrates the new disabled styling. The label updates make it immediately clear which nodes are in the disabled state during testing.

Also applies to: 145-154

src/patternfly/components/TreeView/tree-view.scss (1)

448-453: Well-structured disabled state implementation.

The .pf-m-disabled modifier correctly overrides the color variables using a clean cascading approach. The implementation properly excludes the toggle button color, allowing it to remain functional as intended.

Based on learnings, the toggle button color is intentionally not modified to indicate the item can still be expanded/collapsed.

Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

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

Had one small nit but commented and committed the suggestion - 3684f4e

There are a few minor styling tweaks needed but opened a follow up for those so we can get this in react. Here's the follow up - #8053

Otherwise LGTM!! πŸŒ³πŸ‘€

@mcoker mcoker merged commit 0b46794 into patternfly:main Jan 12, 2026
5 checks passed
@patternfly-build
Copy link
Collaborator

πŸŽ‰ This PR is included in version 6.5.0-prerelease.34 πŸŽ‰

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.

TreeView - disabled styling for TreeViewListItem elements

4 participants