Skip to content

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

Merged
thatblindgeye merged 5 commits intopatternfly:mainfrom
kmcfaul:glass-updates-table
Apr 1, 2026
Merged

feat(Table): update isPlain to apply no-plain when false#12287
thatblindgeye merged 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

  • New Features

    • Table component now includes a new optional isNoPlainOnGlass beta prop that provides an alternative styling mode, enabling enhanced visual customization while working independently from existing styling options.
  • Tests

    • Expanded Table component test coverage to verify correct application of style modifiers based on prop configuration.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 23, 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

The Table component's TableProps interface now includes an optional isNoPlainOnGlass boolean prop. When enabled, it applies the noPlainOnGlass CSS modifier to the table element. Tests verify the modifier is applied correctly based on the prop's boolean value.

Changes

Cohort / File(s) Summary
Component Implementation
packages/react-table/src/components/Table/Table.tsx
Added optional isNoPlainOnGlass?: boolean prop to TableProps. TableBase destructures this prop with a default of false and conditionally applies styles.modifiers.noPlainOnGlass modifier to the table's className when enabled.
Component Tests
packages/react-table/src/components/Table/__tests__/Table.test.tsx
Added test assertions verifying styles.modifiers.noPlainOnGlass modifier is present when isNoPlainOnGlass is true and absent when undefined or false. Tests follow the same pattern for the existing isPlain prop behavior.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested reviewers

  • nicolethoen
  • 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 isNoPlainOnGlass beta prop to apply pf-m-no-plain CSS modifier when isPlain is false.
Linked Issues check ✅ Passed The PR successfully implements the requirement from issue #12272: adds isNoPlainOnGlass prop to Table component that applies pf-m-no-plain CSS modifier class when enabled, with corresponding unit tests.
Out of Scope Changes check ✅ Passed All changes are scoped to the linked issue requirement: the new isNoPlainOnGlass prop, its integration in TableBase, and comprehensive unit tests for the feature.
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

@kmcfaul kmcfaul force-pushed the glass-updates-table branch from 8a28744 to 460611d Compare April 1, 2026 13:52
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={false} is still not driving noPlainOnGlass, and modifiers can conflict.

Line 102 defaults isPlain in a way that masks whether false was passed explicitly, and Line 232 only checks isNoPlainOnGlass. This still misses the explicit-false requirement and allows plain + noPlainOnGlass together.

Suggested fix (preserve PatternFly default semantics, add explicit-false detection)
-const TableBase: React.FunctionComponent<TableProps> = ({
-  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) => {
+const TableBase: React.FunctionComponent<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;
+
+  const isPlainExplicitlyFalse =
+    Object.prototype.hasOwnProperty.call(tableProps, 'isPlain') && tableProps.isPlain === false;
+  const shouldApplyNoPlainOnGlass = (isNoPlainOnGlass || isPlainExplicitlyFalse) && !isPlain;
...
-          isNoPlainOnGlass && styles.modifiers.noPlainOnGlass,
+          shouldApplyNoPlainOnGlass && styles.modifiers.noPlainOnGlass,

Based on learnings: In PatternFly React, isPlain should keep its default false convention, and omitted isPlain should remain equivalent to false.

Also applies to: 231-232

🤖 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,
The problem is defaulting isPlain in the TableBase parameter list masks whether
it was passed and allows conflicting modifiers; remove the default in the
function signature for isPlain so it can be undefined, then compute a local
effectiveIsPlain = isPlain ?? false and use that when applying the
no-plain-on-glass logic (e.g. replace the current check that only uses
isNoPlainOnGlass with use: if (isNoPlainOnGlass && !effectiveIsPlain) { ... } ),
ensuring TableBase, isPlain and isNoPlainOnGlass are the symbols updated so
plain and noPlainOnGlass cannot conflict.
🤖 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: The problem is defaulting isPlain in the TableBase
parameter list masks whether it was passed and allows conflicting modifiers;
remove the default in the function signature for isPlain so it can be undefined,
then compute a local effectiveIsPlain = isPlain ?? false and use that when
applying the no-plain-on-glass logic (e.g. replace the current check that only
uses isNoPlainOnGlass with use: if (isNoPlainOnGlass && !effectiveIsPlain) { ...
} ), ensuring TableBase, isPlain and isNoPlainOnGlass are the symbols updated so
plain and noPlainOnGlass cannot conflict.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9de11f4a-2b77-4a1a-837d-ae13b5159c30

📥 Commits

Reviewing files that changed from the base of the PR and between 8a28744 and 460611d.

📒 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

@thatblindgeye thatblindgeye merged commit c9853de into patternfly:main Apr 1, 2026
14 checks passed
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

5 participants