Skip to content

feat(Data list): Add isNoPlainOnGlass prop to add pf-m-no-plain modfier to the data list#12292

Open
tlabaj wants to merge 2 commits intopatternfly:mainfrom
tlabaj:datatlist_glass
Open

feat(Data list): Add isNoPlainOnGlass prop to add pf-m-no-plain modfier to the data list#12292
tlabaj wants to merge 2 commits intopatternfly:mainfrom
tlabaj:datatlist_glass

Conversation

@tlabaj
Copy link
Contributor

@tlabaj tlabaj commented Mar 25, 2026

What: Closes #12275

  • Added beta prop isNoPlainOnGlass; when true, applies the pf-m-no-plain on the root list so plain styling is not forced under the glass theme.
  • Added test to over isNoPlainOnGlass by asserting styles.modifiers.noPlain.

Additional issues:
Normalize JSDoc wording to “data list” (and small casing tweaks) in DataListAction, DataListCell, DataListItemCells, and DataListToggle — no API or behavior changes there.

Summary by CodeRabbit

  • New Features

    • Added a beta toggle to DataList to enable an alternative "no plain on glass" styling modifier.
  • Bug Fixes

    • DataList now warns when conflicting styling options are used together to guide correct usage.
  • Documentation

    • Standardized and clarified JSDoc wording across DataList, DataListAction, DataListCell, DataListItemCells, and DataListToggle.
  • Tests

    • Added tests for the new styling toggle and its warning behavior.

@coderabbitai
Copy link

coderabbitai bot commented Mar 25, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4f4b7704-e395-45af-8f77-9dc350f495ea

📥 Commits

Reviewing files that changed from the base of the PR and between c4ea313 and 656602c.

📒 Files selected for processing (1)
  • packages/react-core/src/components/DataList/DataListItemCells.tsx
✅ Files skipped from review due to trivial changes (1)
  • packages/react-core/src/components/DataList/DataListItemCells.tsx

Walkthrough

Adds an optional @beta prop isNoPlainOnGlass to DataList; destructures it with default false, emits console.warn if both isPlain and isNoPlainOnGlass are true, and conditionally applies styles.modifiers.noPlain to the root <ul>. Also standardizes JSDoc wording across DataList components and adds tests for the new prop and warning.

Changes

Cohort / File(s) Summary
Core Feature
packages/react-core/src/components/DataList/DataList.tsx
Adds isNoPlainOnGlass?: boolean (@beta); destructures with default false; logs console.warn when both isPlain and isNoPlainOnGlass are true; applies styles.modifiers.noPlain to the root <ul> when set.
JSDoc Updates
packages/react-core/src/components/DataList/DataListAction.tsx, packages/react-core/src/components/DataList/DataListCell.tsx, packages/react-core/src/components/DataList/DataListItemCells.tsx, packages/react-core/src/components/DataList/DataListToggle.tsx
Text-only JSDoc/comment edits to standardize lowercase/phrasing and fix minor typos; no type or runtime changes.
Tests
packages/react-core/src/components/DataList/__tests__/DataList.test.tsx
Adds @testing-library/jest-dom import; tests for isNoPlainOnGlass class application and console.warn behavior when combined with isPlain; verifies no warning when only one prop is provided.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • nicolethoen
  • thatblindgeye
  • wise-king-sullyman
🚥 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 feature: adding an isNoPlainOnGlass prop to apply the pf-m-no-plain modifier to DataList.
Linked Issues check ✅ Passed The PR implements the core requirement from #12275 by adding isNoPlainOnGlass prop that applies pf-m-no-plain modifier when needed, with tests confirming the modifier is applied correctly.
Out of Scope Changes check ✅ Passed All changes are within scope: the isNoPlainOnGlass implementation directly addresses #12275, while JSDoc normalization updates are minor documentation improvements to related DataList components.
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
Collaborator

patternfly-build commented Mar 25, 2026

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: 3

🧹 Nitpick comments (1)
packages/react-core/src/components/DataList/__tests__/DataList.test.tsx (1)

81-84: Add a complementary negative-path assertion for isNoPlainOnGlass.

Consider adding a test that verifies styles.modifiers.noPlain is not present when the prop is omitted, to lock in opt-in behavior.

🧪 Suggested test addition
+test(`Does not render with ${styles.modifiers.noPlain} when isNoPlainOnGlass is false`, () => {
+  render(<DataList aria-label="list" />);
+  expect(screen.getByLabelText('list')).not.toHaveClass(styles.modifiers.noPlain);
+});
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/react-core/src/components/DataList/__tests__/DataList.test.tsx`
around lines 81 - 84, Add a complementary negative-path test for the DataList
component to assert that styles.modifiers.noPlain is not applied when
isNoPlainOnGlass is omitted: create a test (e.g., "does not render with noPlain
when isNoPlainOnGlass is false/omitted") that renders <DataList
aria-label="list" /> (no isNoPlainOnGlass prop) and expects
screen.getByLabelText('list') not.toHaveClass(styles.modifiers.noPlain);
reference the existing test name and the DataList component and
styles.modifiers.noPlain to locate where to add this spec.
🤖 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/DataList/DataListAction.tsx`:
- Around line 10-11: The JSDoc for the id property on DataListActionProps is
incorrect (it calls it a “data list toggle number”); update the comment for the
id field in DataListActionProps (in DataListAction.tsx) to accurately describe
it as the unique identifier for the action (e.g., "Unique identifier for the
DataListAction" or "ID of the action element"), so the JSDoc matches the
interface purpose.

In `@packages/react-core/src/components/DataList/DataListCell.tsx`:
- Around line 12-15: Update the JSDoc for the DataListCell props: replace the
"Width (from 1-5) to the data list cell" comment for the width prop with a
clearer description such as "Width scale for the data list cell (1-5)"; and
replace "Enables the body content to fill the height of the card" for isFilled
with something accurate like "If true, allows the cell content to grow to fill
available height." Edit the JSDoc comments adjacent to the width and isFilled
prop declarations in DataListCell so the wording is concise and precise.

In `@packages/react-core/src/components/DataList/DataListItemCells.tsx`:
- Line 5: The JSDoc for the DataListItemCells component has a typo in the prop
description ("one ore more" → "one or more"); update the comment above the prop
(the JSDoc that mentions "Children should be one ore more <DataListCell> nodes")
in DataListItemCells.tsx so it reads "one or more" and keep the rest of the
phrasing unchanged.

---

Nitpick comments:
In `@packages/react-core/src/components/DataList/__tests__/DataList.test.tsx`:
- Around line 81-84: Add a complementary negative-path test for the DataList
component to assert that styles.modifiers.noPlain is not applied when
isNoPlainOnGlass is omitted: create a test (e.g., "does not render with noPlain
when isNoPlainOnGlass is false/omitted") that renders <DataList
aria-label="list" /> (no isNoPlainOnGlass prop) and expects
screen.getByLabelText('list') not.toHaveClass(styles.modifiers.noPlain);
reference the existing test name and the DataList component and
styles.modifiers.noPlain to locate where to add this spec.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a752ea0d-05c2-4bd6-b2c7-9360ce1ab859

📥 Commits

Reviewing files that changed from the base of the PR and between 550ad93 and a5175b0.

📒 Files selected for processing (6)
  • packages/react-core/src/components/DataList/DataList.tsx
  • packages/react-core/src/components/DataList/DataListAction.tsx
  • packages/react-core/src/components/DataList/DataListCell.tsx
  • packages/react-core/src/components/DataList/DataListItemCells.tsx
  • packages/react-core/src/components/DataList/DataListToggle.tsx
  • packages/react-core/src/components/DataList/__tests__/DataList.test.tsx

Comment on lines +10 to 11
/** Identify the data list toggle number */
id: string;
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

id JSDoc is inaccurate for DataListActionProps.

The description references a “data list toggle number,” but this interface is for data list actions.

✏️ Suggested edit
-  /** Identify the data list toggle number */
+  /** Identify the data list action */
   id: string;
📝 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
/** Identify the data list toggle number */
id: string;
/** Identify the data list action */
id: string;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/react-core/src/components/DataList/DataListAction.tsx` around lines
10 - 11, The JSDoc for the id property on DataListActionProps is incorrect (it
calls it a “data list toggle number”); update the comment for the id field in
DataListActionProps (in DataListAction.tsx) to accurately describe it as the
unique identifier for the action (e.g., "Unique identifier for the
DataListAction" or "ID of the action element"), so the JSDoc matches the
interface purpose.

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.

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

74-79: Warning fires on every render.

When both props are true, this warning will log on every component re-render. For a heavily re-rendering component, this could flood the console. Consider guarding with a ref or useEffect to warn only once per mount.

That said, since this is a @beta prop and users should heed the warning and fix their configuration, the current approach is acceptable.

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

In `@packages/react-core/src/components/DataList/DataList.tsx` around lines 74 -
79, The warning currently logged inside the render when both isPlain and
isNoPlainOnGlass are true should be emitted only once per mount; move the
console.warn into a side-effect (e.g., useEffect with an empty dependency array)
or guard it with a ref flag so it runs only once. Locate the check using isPlain
and isNoPlainOnGlass in the DataList component (DataList.tsx) and replace the
inline warning with a useEffect that checks those props and calls console.warn a
single time, or implement a useRef boolean (e.g., warnedRef) to prevent repeated
logs across re-renders.
packages/react-core/src/components/DataList/__tests__/DataList.test.tsx (1)

86-96: Consider adding a test to verify class behavior when both props are true.

The warning states that isPlain takes precedence and isNoPlainOnGlass will have no effect. However, the current implementation applies both CSS classes when both props are true. Consider adding a test to explicitly verify the expected class application:

test('Applies both plain and noPlain modifiers when both isPlain and isNoPlainOnGlass are true', () => {
  render(<DataList aria-label="list" isPlain isNoPlainOnGlass />);
  expect(screen.getByLabelText('list')).toHaveClass(styles.modifiers.plain);
  expect(screen.getByLabelText('list')).toHaveClass(styles.modifiers.noPlain);
});

This documents the actual behavior and guards against future changes.

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

In `@packages/react-core/src/components/DataList/__tests__/DataList.test.tsx`
around lines 86 - 96, Add a test that asserts actual CSS class application when
both props are true: render the DataList component with isPlain and
isNoPlainOnGlass and assert the rendered element (queried by aria-label "list")
has both styles.modifiers.plain and styles.modifiers.noPlain classes; update or
add a test named like 'Applies both plain and noPlain modifiers when both
isPlain and isNoPlainOnGlass are true' to live alongside the existing warning
test so the suite documents and guards the current behavior of the DataList
component.
🤖 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/DataList/__tests__/DataList.test.tsx`:
- Around line 86-96: Add a test that asserts actual CSS class application when
both props are true: render the DataList component with isPlain and
isNoPlainOnGlass and assert the rendered element (queried by aria-label "list")
has both styles.modifiers.plain and styles.modifiers.noPlain classes; update or
add a test named like 'Applies both plain and noPlain modifiers when both
isPlain and isNoPlainOnGlass are true' to live alongside the existing warning
test so the suite documents and guards the current behavior of the DataList
component.

In `@packages/react-core/src/components/DataList/DataList.tsx`:
- Around line 74-79: The warning currently logged inside the render when both
isPlain and isNoPlainOnGlass are true should be emitted only once per mount;
move the console.warn into a side-effect (e.g., useEffect with an empty
dependency array) or guard it with a ref flag so it runs only once. Locate the
check using isPlain and isNoPlainOnGlass in the DataList component
(DataList.tsx) and replace the inline warning with a useEffect that checks those
props and calls console.warn a single time, or implement a useRef boolean (e.g.,
warnedRef) to prevent repeated logs across re-renders.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c149f1c2-3831-4e09-adcb-aad1dfcb3ca2

📥 Commits

Reviewing files that changed from the base of the PR and between a5175b0 and c4ea313.

📒 Files selected for processing (6)
  • packages/react-core/src/components/DataList/DataList.tsx
  • packages/react-core/src/components/DataList/DataListAction.tsx
  • packages/react-core/src/components/DataList/DataListCell.tsx
  • packages/react-core/src/components/DataList/DataListItemCells.tsx
  • packages/react-core/src/components/DataList/DataListToggle.tsx
  • packages/react-core/src/components/DataList/__tests__/DataList.test.tsx
✅ Files skipped from review due to trivial changes (4)
  • packages/react-core/src/components/DataList/DataListAction.tsx
  • packages/react-core/src/components/DataList/DataListItemCells.tsx
  • packages/react-core/src/components/DataList/DataListToggle.tsx
  • packages/react-core/src/components/DataList/DataListCell.tsx

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.

DataList - Glass style follow up

2 participants