Skip to content

feat(Table): update isPlain to apply no-plain when false#12287

Open
kmcfaul wants to merge 5 commits intopatternfly:mainfrom
kmcfaul:glass-updates-table
Open

feat(Table): update isPlain to apply no-plain when false#12287
kmcfaul wants to merge 5 commits intopatternfly:mainfrom
kmcfaul:glass-updates-table

Conversation

@kmcfaul
Copy link
Copy Markdown
Contributor

@kmcfaul kmcfaul commented Mar 23, 2026

What: Closes #12272

  • Adds isNoPlainOnGlass flag to apply pf-m-no-plain.
  • Adds unit tests for isNoPlainOnGlass.

Summary by CodeRabbit

  • Improvements

    • Added an option to disable plain-style rendering when tables are on glass/transparent backgrounds, improving visual consistency while preserving existing plain-style behavior.
  • Tests

    • Added tests confirming plain-style and glass-background combinations render the correct classes in all relevant states.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 23, 2026

Walkthrough

Added an optional isNoPlainOnGlass?: boolean prop (default false) to the Table component; when true the table's computed className includes styles.modifiers.noPlainOnGlass. Tests were added to assert presence/absence of styles.modifiers.plain and styles.modifiers.noPlainOnGlass. Several package devDependency versions were bumped.

Changes

Cohort / File(s) Summary
Table component
packages/react-table/src/components/Table/Table.tsx
Added optional prop isNoPlainOnGlass?: boolean (default false); className computation conditionally adds styles.modifiers.noPlainOnGlass when true.
Table tests
packages/react-table/src/components/Table/__tests__/Table.test.tsx
Added tests asserting presence/absence of styles.modifiers.plain and styles.modifiers.noPlainOnGlass for various prop combinations.
Package devDependency bumps
packages/react-core/package.json, packages/react-docs/package.json, packages/react-icons/package.json, packages/react-styles/package.json, packages/react-tokens/package.json
Updated @patternfly/patternfly devDependency from 6.5.0-prerelease.55 to 6.5.0-prerelease.58 across multiple package manifests.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • thatblindgeye
  • nicolethoen
🚥 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 the isNoPlainOnGlass prop to the Table component to apply the no-plain modifier when needed.
Linked Issues check ✅ Passed The PR successfully implements issue #12272's requirement to add support for applying the pf-m-no-plain modifier class when opting out of plain styling.
Out of Scope Changes check ✅ Passed All changes are within scope: the new isNoPlainOnGlass prop and tests directly address the linked issue, and the dependency version updates support the CSS modifier implementation.
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.

@kmcfaul kmcfaul changed the title Glass updates table @kmcfaul feat(Table): update isPlain to apply no-plain when false Mar 23, 2026
@kmcfaul kmcfaul changed the title @kmcfaul feat(Table): update isPlain to apply no-plain when false feat(Table): update isPlain to apply no-plain when false Mar 23, 2026
@patternfly-build
Copy link
Copy Markdown
Collaborator

patternfly-build commented Mar 23, 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: 2

🤖 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-table/src/components/Table/Table.tsx`:
- Around line 53-54: The Table component currently introduces a new public prop
isNoPlainOnGlass instead of making explicit isPlain={false} produce the
pf-m-no-plain modifier; remove or ignore the public isNoPlainOnGlass usage and
change the class-computation logic in the Table component (where you previously
referenced isNoPlainOnGlass and isPlain) to add the "pf-m-no-plain" class when
the theme is glass AND isPlain === false (strict check for explicit false),
leaving isPlain as an optional prop (do not set a default that masks undefined)
so you can detect an explicit false; update all places that previously used
isNoPlainOnGlass (and relevant className concatenations) to use this new
explicit-check logic and remove the redundant prop from the component API.
- Around line 231-233: The code currently adds both plain and noPlain modifiers
which can conflict; update the class logic so the noPlain modifier
(styles.modifiers.noPlain) is only applied when isNoPlainOnGlass is true AND
isPlain is false (e.g., change the predicate to isNoPlainOnGlass && !isPlain)
while leaving isPlain && styles.modifiers.plain and hasNoInset &&
stylesTreeView.modifiers.noInset unchanged; locate this in the Table component
where isPlain, isNoPlainOnGlass, styles.modifiers.plain and
styles.modifiers.noPlain are used.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 75876afa-0a2b-415e-a198-ab561dd936b1

📥 Commits

Reviewing files that changed from the base of the PR and between c7dd546 and 86853d0.

📒 Files selected for processing (2)
  • packages/react-table/src/components/Table/Table.tsx
  • packages/react-table/src/components/Table/__tests__/Table.test.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/react-table/src/components/Table/tests/Table.test.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.

♻️ Duplicate comments (1)
packages/react-table/src/components/Table/Table.tsx (1)

95-103: ⚠️ Potential issue | 🟠 Major

isPlain precedence is not actually enforced, and explicit isPlain={false} is still not represented in class logic.

At Line 130, the warning says isNoPlainOnGlass is ignored when isPlain is true, but Line 239 still adds styles.modifiers.noPlain, so both modifiers can be emitted together. Also, current logic still does not map explicit isPlain={false} to pf-m-no-plain as described in the linked objective.

Proposed fix
-const TableBase: React.FunctionComponent<TableProps> = ({
+const TableBase: React.FunctionComponent<TableProps> = (tableProps: TableProps) => {
+  const {
   children,
   className,
   variant,
   borders = true,
   isStickyHeader = false,
   isPlain = false,
   isNoPlainOnGlass = false,
   gridBreakPoint = TableGridBreakpoint.gridMd,
   'aria-label': ariaLabel,
   role = 'grid',
   innerRef,
   ouiaId,
   ouiaSafe = true,
   isTreeTable = false,
   isNested = false,
   isStriped = false,
   isExpandable = false,
   hasAnimations: hasAnimationsProp,
   hasNoInset = false,
   // eslint-disable-next-line `@typescript-eslint/no-unused-vars`
   nestedHeaderColumnSpans,
   selectableRowCaptionText,
   ...props
-}: TableProps) => {
+  } = tableProps;
+
+  const isPlainExplicitlyFalse =
+    Object.prototype.hasOwnProperty.call(tableProps, 'isPlain') && tableProps.isPlain === false;
+  const shouldApplyNoPlain = isNoPlainOnGlass || isPlainExplicitlyFalse;

-  if (isPlain && isNoPlainOnGlass) {
+  if (isPlain && shouldApplyNoPlain) {
     // eslint-disable-next-line no-console
     console.warn(
       "Table: When both isPlain and isNoPlainOnGlass are true, isPlain will take precedence and isNoPlainOnGlass will have no effect. It's recommended to pass only one prop according to the current theme."
     );
   }

@@
-          isNoPlainOnGlass && styles.modifiers.noPlain,
+          !isPlain && shouldApplyNoPlain && styles.modifiers.noPlain,

Based on learnings: In PatternFly React, isPlain should remain defaulted to false, and explicit-false handling should not require changing that default.

Also applies to: 127-132, 238-239

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

In `@packages/react-table/src/components/Table/Table.tsx` around lines 95 - 103,
TableBase's class logic must treat isPlain precedence correctly and detect
explicit isPlain={false}; stop defaulting isPlain in the parameter list and
instead read it from the props object so you can detect whether it was provided
(use Object.prototype.hasOwnProperty.call(props, 'isPlain')). In TableBase, if
isPlain === true then ignore isNoPlainOnGlass and do NOT add
styles.modifiers.noPlain; otherwise add styles.modifiers.noPlain when either (a)
isPlain was explicitly set to false or (b) isNoPlainOnGlass is true and isPlain
is not true. Update the class-name construction to use this detection and keep
the prop default behavior (treat undefined as false for rendering) while
enforcing the precedence rules for isPlain and isNoPlainOnGlass.
🧹 Nitpick comments (1)
packages/react-table/src/components/Table/Table.tsx (1)

127-132: Move warning logic to useEffect to avoid side effects in render.

The console.warn currently runs on every render when both isPlain and isNoPlainOnGlass are true, violating React's requirement that render functions remain pure. Side effects like logging should run in useEffect instead, which executes after render. Since useEffect is already imported, wrapping this warning with dependencies [isPlain, isNoPlainOnGlass] will ensure it only triggers when those props change, not on every render.

Suggested refactor
-  if (isPlain && isNoPlainOnGlass) {
-    // eslint-disable-next-line no-console
-    console.warn(
-      "Table: When both isPlain and isNoPlainOnGlass are true, isPlain will take precedence and isNoPlainOnGlass will have no effect. It's recommended to pass only one prop according to the current theme."
-    );
-  }
+  useEffect(() => {
+    if (isPlain && isNoPlainOnGlass) {
+      // eslint-disable-next-line no-console
+      console.warn(
+        "Table: When both isPlain and isNoPlainOnGlass are true, isPlain will take precedence and isNoPlainOnGlass will have no effect. It's recommended to pass only one prop according to the current theme."
+      );
+    }
+  }, [isPlain, isNoPlainOnGlass]);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/react-table/src/components/Table/Table.tsx` around lines 127 - 132,
The render currently logs a warning when both isPlain and isNoPlainOnGlass are
true, causing a side effect inside the Table component render; move that
console.warn into a useEffect inside the Table component (use the existing
useEffect import) and run it with dependencies [isPlain, isNoPlainOnGlass] so
the warning only fires when those props change, preserving render purity.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@packages/react-table/src/components/Table/Table.tsx`:
- Around line 95-103: TableBase's class logic must treat isPlain precedence
correctly and detect explicit isPlain={false}; stop defaulting isPlain in the
parameter list and instead read it from the props object so you can detect
whether it was provided (use Object.prototype.hasOwnProperty.call(props,
'isPlain')). In TableBase, if isPlain === true then ignore isNoPlainOnGlass and
do NOT add styles.modifiers.noPlain; otherwise add styles.modifiers.noPlain when
either (a) isPlain was explicitly set to false or (b) isNoPlainOnGlass is true
and isPlain is not true. Update the class-name construction to use this
detection and keep the prop default behavior (treat undefined as false for
rendering) while enforcing the precedence rules for isPlain and
isNoPlainOnGlass.

---

Nitpick comments:
In `@packages/react-table/src/components/Table/Table.tsx`:
- Around line 127-132: The render currently logs a warning when both isPlain and
isNoPlainOnGlass are true, causing a side effect inside the Table component
render; move that console.warn into a useEffect inside the Table component (use
the existing useEffect import) and run it with dependencies [isPlain,
isNoPlainOnGlass] so the warning only fires when those props change, preserving
render purity.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: bfc79189-f0c1-45d1-bc66-4baff6fd5ff6

📥 Commits

Reviewing files that changed from the base of the PR and between 86853d0 and 213a741.

📒 Files selected for processing (1)
  • packages/react-table/src/components/Table/Table.tsx

isStriped && styles.modifiers.striped,
isExpandable && styles.modifiers.expandable,
isPlain && styles.modifiers.plain,
isNoPlainOnGlass && styles.modifiers.noPlain,
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.

Approved with the caveat that we're just waiting on core bump to go in to update this class 🙈

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.

♻️ Duplicate comments (1)
packages/react-table/src/components/Table/Table.tsx (1)

53-54: ⚠️ Potential issue | 🟠 Major

isPlain={false} behavior is still split behind a new prop instead of the existing API.

At Line 53 and Line 102, adding isNoPlainOnGlass introduces a second public toggle; at Line 232 the modifier is driven by that new prop rather than explicit isPlain={false}. This diverges from the PR objective and issue requirement.

Suggested direction (keep default pattern, detect explicit false)
-export interface TableProps extends React.HTMLProps<HTMLTableElement>, OUIAProps {
+export interface TableProps extends React.HTMLProps<HTMLTableElement>, OUIAProps {
@@
-  /** `@beta` Flag indicating if the table should not have plain styling when in the glass theme */
-  isNoPlainOnGlass?: boolean;
@@
-const TableBase: React.FunctionComponent<TableProps> = ({
-  children,
-  className,
-  variant,
-  borders = true,
-  isStickyHeader = false,
-  isPlain = false,
-  isNoPlainOnGlass = false,
+const TableBase: React.FunctionComponent<TableProps> = (tableProps) => {
+  const {
+    children,
+    className,
+    variant,
+    borders = true,
+    isStickyHeader = false,
+    isPlain = false,
@@
-  ...props
-}: TableProps) => {
+    ...props
+  } = tableProps;
+
+  const isPlainExplicitlyFalse =
+    Object.prototype.hasOwnProperty.call(tableProps, 'isPlain') && tableProps.isPlain === false;
@@
-          isPlain && styles.modifiers.plain,
-          isNoPlainOnGlass && styles.modifiers.noPlainOnGlass,
+          isPlain && styles.modifiers.plain,
+          isPlainExplicitlyFalse && styles.modifiers.noPlain,

Based on learnings: In PatternFly React, isPlain should remain defaulted to false; omitting it should still behave like isPlain={false}.

Also applies to: 95-103, 231-233

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

In `@packages/react-table/src/components/Table/Table.tsx` around lines 53 - 54,
The new prop isNoPlainOnGlass should be removed and the Table component should
honor explicit isPlain={false} instead of introducing a second public toggle;
update the Table props and logic (references: isNoPlainOnGlass, isPlain, Table
component) so the modifier for the glass theme is applied only when isPlain is
explicitly false (detect using a strict check like isPlain === false or checking
props.hasOwnProperty('isPlain')), revert any usage that drives behavior from
isNoPlainOnGlass to use that explicit isPlain check, and remove the
isNoPlainOnGlass declaration and any related conditional branches so the
existing API (omitting isPlain behaves like false by default) is preserved.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@packages/react-table/src/components/Table/Table.tsx`:
- Around line 53-54: The new prop isNoPlainOnGlass should be removed and the
Table component should honor explicit isPlain={false} instead of introducing a
second public toggle; update the Table props and logic (references:
isNoPlainOnGlass, isPlain, Table component) so the modifier for the glass theme
is applied only when isPlain is explicitly false (detect using a strict check
like isPlain === false or checking props.hasOwnProperty('isPlain')), revert any
usage that drives behavior from isNoPlainOnGlass to use that explicit isPlain
check, and remove the isNoPlainOnGlass declaration and any related conditional
branches so the existing API (omitting isPlain behaves like false by default) is
preserved.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: dec86a92-a5b0-44dc-8bb7-264a71e17cc6

📥 Commits

Reviewing files that changed from the base of the PR and between 213a741 and 8a28744.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (7)
  • packages/react-core/package.json
  • packages/react-docs/package.json
  • packages/react-icons/package.json
  • packages/react-styles/package.json
  • packages/react-table/src/components/Table/Table.tsx
  • packages/react-table/src/components/Table/__tests__/Table.test.tsx
  • packages/react-tokens/package.json
✅ Files skipped from review due to trivial changes (6)
  • packages/react-tokens/package.json
  • packages/react-docs/package.json
  • packages/react-table/src/components/Table/tests/Table.test.tsx
  • packages/react-styles/package.json
  • packages/react-core/package.json
  • packages/react-icons/package.json

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.

Table - glass style follow up

4 participants