Skip to content

feat(Drawer): Added support for glass#12305

Open
tlabaj wants to merge 8 commits intopatternfly:mainfrom
tlabaj:drawer_glass
Open

feat(Drawer): Added support for glass#12305
tlabaj wants to merge 8 commits intopatternfly:mainfrom
tlabaj:drawer_glass

Conversation

@tlabaj
Copy link
Copy Markdown
Contributor

@tlabaj tlabaj commented Mar 31, 2026

What: Closes #12273

  • Changes to drawer:

    • DrawerColorVariant.noBackground marked @deprecated in enum
  • Changes to DrawerPanelContent:

    • added isGlass (@beta, default false) — applies pf-m-glass
    • added isPlain (@beta, default false) — applies pf-m-plain
    • added isNoPlainOnGlass (@beta, default false) — applies pf-m-no-plain
    • DrawerColorVariant.noBackground marked @deprecated; migrate to isPlain for plain styling (still applies pf-m-no-background so existing snapshots and consumers stay stable).
    • Added unit tests for isGlass, isPlain, isNoPlainOnGlass, and clarified test name for deprecated no-background
  • Changes for DrawerSection:

    • added isPlain (@beta, default false) — applies pf-m-plain

    • DrawerColorVariant.noBackground marked @deprecated; migrate to isPlain for plain styling (still applies pf-m-no-background so existing snapshots and consumers stay stable).

    • Added new test for isPlain

    • Updated PrimaryDetailContentPadding demo: DrawerPanelContent uses isPlain; removed invalid DrawerContent colorVariant="no-background" (not supported on DrawerContent)

Summary by CodeRabbit

  • New Features

    • Added beta styling props (isGlass, isPlain, isNoPlainOnGlass) to DrawerPanelContent for enhanced visual customization.
    • Added isPlain beta prop to DrawerSection.
  • Deprecations

    • The no-background style variant is deprecated; use the new isPlain prop instead.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 31, 2026

Walkthrough

This PR introduces three new beta styling props to Drawer components—isGlass, isPlain, and isNoPlainOnGlass on DrawerPanelContent, plus isPlain on DrawerSection—with corresponding CSS modifier classes applied conditionally. The deprecated DrawerColorVariant.noBackground is marked with JSDoc guidance to migrate to the new props.

Changes

Drawer Styling Props

Layer / File(s) Summary
Type Definitions
packages/react-core/src/components/Drawer/DrawerPanelContent.tsx, packages/react-core/src/components/Drawer/DrawerSection.tsx
DrawerPanelContentProps adds isGlass, isPlain, isNoPlainOnGlass (all optional, beta); DrawerSectionProps adds isPlain (optional, beta).
Deprecation Notices
packages/react-core/src/components/Drawer/Drawer.tsx
DrawerColorVariant.noBackground enum member is annotated with @deprecated JSDoc, recommending isPlain on DrawerPanelContent and DrawerSection instead.
Core Implementation
packages/react-core/src/components/Drawer/DrawerPanelContent.tsx, packages/react-core/src/components/Drawer/DrawerSection.tsx
Components destructure new props (all default to false), and root element className conditionally applies styles.modifiers.glass, styles.modifiers.plain, and styles.modifiers.noPlainOnGlass based on prop values.
Unit Tests
packages/react-core/src/components/Drawer/__tests__/DrawerPanelContent.test.tsx, packages/react-core/src/components/Drawer/__tests__/DrawerSection.test.tsx
Updated test description for deprecated colorVariant="no-background". Added three test cases for DrawerPanelContent verifying each new prop applies the correct modifier class. New DrawerSection test suite with four cases verifying isPlain modifier, combined isPlain + colorVariant, and absence when isPlain is false.
Integration Tests & Glass Theme Utilities
packages/react-integration/cypress/integration/drawer.spec.ts
Added helpers for glass theme testing (parse backgroundColor alpha from both rgba and rgb(... / alpha) formats, detect backdrop-filter). Extended drawer spec with tests for inline/static/overlay variants asserting modifier classes and computed glass visuals (background semi-transparency and/or backdrop-filter). Added DrawerSection isPlain test validating style differences. Included skipped test for isGlass=false case.
Demo Updates
packages/react-core/src/demos/examples/PrimaryDetail/PrimaryDetailContentPadding.tsx, packages/react-integration/demo-app-ts/src/components/demos/DrawerDemo/DrawerDemo.tsx
PrimaryDetailContentPadding updated to use isPlain instead of deprecated colorVariant="no-background". DrawerDemo adds JSX constants for glass/plain/noPlainOnGlass combinations (inline, static, overlay, and theme-no-isGlass), introduces default and plain DrawerSection instances, and adds new div#drawer-glass-plain-demos container with four always-expanded Drawer instances showcasing the new styling modes.
Documentation
packages/react-core/src/components/Drawer/examples/Drawer.md
Minor formatting: added trailing comma after DrawerPanelFocusTrapObject in propComponents array.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • kmcfaul
  • mcoker
  • 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 'feat(Drawer): Added support for glass' directly describes the main feature addition of glass styling support to the Drawer component.
Linked Issues check ✅ Passed The PR successfully implements all requirements from issue #12273: adds isGlass prop to DrawerPanelContent, introduces isPlain as replacement for deprecated no-background, deprecates DrawerColorVariant.noBackground, and updates DrawerSection with isPlain support.
Out of Scope Changes check ✅ Passed All changes are directly related to #12273 scope: Drawer glass/plain styling support, deprecation of no-background, documentation updates, tests for new props, demo updates, and integration tests validating the new functionality.
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

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@patternfly-build
Copy link
Copy Markdown
Collaborator

patternfly-build commented Mar 31, 2026

@tlabaj
Copy link
Copy Markdown
Contributor Author

tlabaj commented Apr 13, 2026

This PR is waiting for patternfly/patternfly#8267 to be fixed.

@mcoker
Copy link
Copy Markdown
Contributor

mcoker commented Apr 13, 2026

@tlabaj just closed patternfly/patternfly#8267, it was done in patternfly/patternfly#8266 which should be in core 6.5.0-prerelease.67

@tlabaj
Copy link
Copy Markdown
Contributor Author

tlabaj commented Apr 13, 2026

@mcoker The modifiers do not seem to be working as expected. isPlain on the DrawerPanelContent and the DrawerSection does not seem to remove the background.

pf-m-glass also does not appear to do anything when applied to the Drawer Panel

Copy link
Copy Markdown
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.

Couple of docs updates but lgtm!

isResizable?: boolean;
/** @beta Flag indicating that the drawer panel should disable glass styles. This prop is intended to work with isPill drawers. */
hasNoGlass?: boolean;
/** @beta Flag indicating that the drawer panel should use glass styles. */
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.

Mention applies glass styles in glass theme

Comment on lines +42 to +45
/** @beta Flag indicating that the drawer panel should use plain styles. */
isPlain?: boolean;
/** @beta Flag indicating that plain styles should be disabled when glass styles are used. */
isNoPlainOnGlass?: boolean;
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.

mention these apply to inline and static drawers.

@mcoker
Copy link
Copy Markdown
Contributor

mcoker commented Apr 24, 2026

@andrew-ronaldson @lboehling right now we're deprecating the colorVariant="no-background" variant that previously existed on drawer in favor of the new isPlain variant.

However, "no-background" currently applies to all drawer panels, including overlay and mobile (when the panel takes up the entire layout). The new isPlain variant only applies to static/inline drawers on desktop - or in other words, when the drawer panel is beside the content and doesn't overlay the main content.

Is that OK? Or should we update isPlain so that it can be applied to overlay drawers and on mobile when the drawer panel overlays all of the content?

@kmcfaul
Copy link
Copy Markdown
Contributor

kmcfaul commented Apr 29, 2026

Looks like an integration test is failing

@mcoker
Copy link
Copy Markdown
Contributor

mcoker commented Apr 29, 2026

Confirmed with @andrew-ronaldson that "Overlay shouldn't be transparent imo." So I think we're good to leave DrawerColorVariant.noBackground as deprecated and remove in a breaking change in favor of isPlain

cc @tlabaj @kmcfaul

Copy link
Copy Markdown
Contributor

@kmcfaul kmcfaul left a comment

Choose a reason for hiding this comment

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

Just needs a fix for the failing integration test, otherwise lgtm.

@tlabaj
Copy link
Copy Markdown
Contributor Author

tlabaj commented May 4, 2026

Just needs a fix for the failing integration test, otherwise lgtm.

@kmcfaul the test is an expected failure since the modifier is not working. It is tracked here

I will disable the test for now so this can be merged.

@tlabaj tlabaj requested a review from kmcfaul May 4, 2026 15:39
@tlabaj tlabaj marked this pull request as ready for review May 4, 2026 15:39
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

🤖 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/Drawer/Drawer.tsx`:
- Around line 8-10: Typo in the deprecation JSDoc for
DrawerColorVariant.noBackground: fix the formatting by replacing
"DrawerSection\`instead" with "DrawerSection instead" (or re-wrap correctly as
`DrawerSection` instead) so generated docs/hovers render properly; update the
comment in the Drawer.tsx JSDoc for DrawerColorVariant.noBackground and keep the
rest of the message referencing using the isPlain prop on DrawerPanelContent and
DrawerSection intact.

In `@packages/react-core/src/components/Drawer/DrawerPanelContent.tsx`:
- Around line 65-68: The JSDoc for the colorVariant prop in
DrawerPanelContent.tsx has a missing space in the deprecation sentence; update
the comment where `colorVariant` is documented (in DrawerPanelContent.tsx) to
read "`no-background` is deprecated; use the `isPlain` prop instead." (i.e.,
insert a space between `no-background` and "is") so the API docs render
correctly and improve readability.

In `@packages/react-integration/cypress/integration/drawer.spec.ts`:
- Around line 26-37: The rgbSlashAlpha function misinterprets percentage alphas
(e.g., "50%") because parseFloat returns 50; update rgbSlashAlpha to detect if
the extracted alpha string ends with '%' and, if so, parse the numeric part and
divide by 100 before returning; also trim whitespace, validate the parsed value
and return undefined for NaN or out-of-range values (ensure final alpha is
clamped/validated to 0–1). Reference: rgbSlashAlpha.
🪄 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: 4fdef979-b559-42b3-bdd6-14d2d47d3664

📥 Commits

Reviewing files that changed from the base of the PR and between 69b6225 and 6eb2110.

📒 Files selected for processing (10)
  • packages/react-core/src/components/Drawer/Drawer.tsx
  • packages/react-core/src/components/Drawer/DrawerPanelContent.tsx
  • packages/react-core/src/components/Drawer/DrawerSection.tsx
  • packages/react-core/src/components/Drawer/__tests__/DrawerPanelContent.test.tsx
  • packages/react-core/src/components/Drawer/__tests__/DrawerSection.test.tsx
  • packages/react-core/src/components/Drawer/examples/Drawer.md
  • packages/react-core/src/demos/examples/PrimaryDetail/PrimaryDetailContentPadding.tsx
  • packages/react-integration/cypress/downloads/downloads.html
  • packages/react-integration/cypress/integration/drawer.spec.ts
  • packages/react-integration/demo-app-ts/src/components/demos/DrawerDemo/DrawerDemo.tsx

Comment on lines +8 to +10
/**
* @deprecated `DrawerColorVariant.noBackground` is deprecated. Use the `isPlain` prop on `DrawerPanelContent` and the `DrawerSection`instead.
*/
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 | ⚡ Quick win

Fix deprecation JSDoc typo in public API docs.

The deprecation text has a formatting typo (DrawerSection\instead`) that will show up in generated docs and editor hovers.

Proposed fix
-   * `@deprecated` `DrawerColorVariant.noBackground` is deprecated. Use the `isPlain` prop on `DrawerPanelContent` and the `DrawerSection`instead.
+   * `@deprecated` `DrawerColorVariant.noBackground` is deprecated. Use the `isPlain` prop on `DrawerPanelContent` and `DrawerSection` instead.
📝 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
/**
* @deprecated `DrawerColorVariant.noBackground` is deprecated. Use the `isPlain` prop on `DrawerPanelContent` and the `DrawerSection`instead.
*/
/**
* `@deprecated` `DrawerColorVariant.noBackground` is deprecated. Use the `isPlain` prop on `DrawerPanelContent` and `DrawerSection` instead.
*/
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/react-core/src/components/Drawer/Drawer.tsx` around lines 8 - 10,
Typo in the deprecation JSDoc for DrawerColorVariant.noBackground: fix the
formatting by replacing "DrawerSection\`instead" with "DrawerSection instead"
(or re-wrap correctly as `DrawerSection` instead) so generated docs/hovers
render properly; update the comment in the Drawer.tsx JSDoc for
DrawerColorVariant.noBackground and keep the rest of the message referencing
using the isPlain prop on DrawerPanelContent and DrawerSection intact.

Comment on lines +65 to +68
/**
* Color variant of the background of the drawer panel.
* The `no-background`is deprecated; use the `isPlain` prop instead.
*/
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 | ⚡ Quick win

Clean up deprecation sentence spacing in colorVariant docs.

There’s a missing space in ``no-backgroundis, which hurts API doc readability.

Proposed fix
-   * The `no-background`is deprecated; use the `isPlain` prop instead.
+   * The `no-background` value is deprecated; use the `isPlain` prop instead.
📝 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
/**
* Color variant of the background of the drawer panel.
* The `no-background`is deprecated; use the `isPlain` prop instead.
*/
/**
* Color variant of the background of the drawer panel.
* The `no-background` value is deprecated; use the `isPlain` prop instead.
*/
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/react-core/src/components/Drawer/DrawerPanelContent.tsx` around
lines 65 - 68, The JSDoc for the colorVariant prop in DrawerPanelContent.tsx has
a missing space in the deprecation sentence; update the comment where
`colorVariant` is documented (in DrawerPanelContent.tsx) to read
"`no-background` is deprecated; use the `isPlain` prop instead." (i.e., insert a
space between `no-background` and "is") so the API docs render correctly and
improve readability.

Comment on lines +26 to +37
const rgbSlashAlpha = (color: string): number | undefined => {
if (!color.startsWith('rgb(')) {
return undefined;
}
const slash = color.indexOf('/');
const close = color.lastIndexOf(')');
if (slash === -1 || close === -1 || slash >= close) {
return undefined;
}
const a = parseFloat(color.slice(slash + 1, close).trim());
return Number.isNaN(a) ? undefined : a;
};
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 | ⚡ Quick win

Handle percentage alpha correctly in rgbSlashAlpha.

parseFloat('50%') returns 50, so semi-transparent colors written as percentages can be treated as opaque by mistake.

Proposed fix
 const rgbSlashAlpha = (color: string): number | undefined => {
   if (!color.startsWith('rgb(')) {
     return undefined;
   }
   const slash = color.indexOf('/');
   const close = color.lastIndexOf(')');
   if (slash === -1 || close === -1 || slash >= close) {
     return undefined;
   }
-  const a = parseFloat(color.slice(slash + 1, close).trim());
-  return Number.isNaN(a) ? undefined : a;
+  const rawAlpha = color.slice(slash + 1, close).trim();
+  const parsedAlpha = parseFloat(rawAlpha);
+  if (Number.isNaN(parsedAlpha)) {
+    return undefined;
+  }
+  return rawAlpha.endsWith('%') ? parsedAlpha / 100 : parsedAlpha;
 };
📝 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
const rgbSlashAlpha = (color: string): number | undefined => {
if (!color.startsWith('rgb(')) {
return undefined;
}
const slash = color.indexOf('/');
const close = color.lastIndexOf(')');
if (slash === -1 || close === -1 || slash >= close) {
return undefined;
}
const a = parseFloat(color.slice(slash + 1, close).trim());
return Number.isNaN(a) ? undefined : a;
};
const rgbSlashAlpha = (color: string): number | undefined => {
if (!color.startsWith('rgb(')) {
return undefined;
}
const slash = color.indexOf('/');
const close = color.lastIndexOf(')');
if (slash === -1 || close === -1 || slash >= close) {
return undefined;
}
const rawAlpha = color.slice(slash + 1, close).trim();
const parsedAlpha = parseFloat(rawAlpha);
if (Number.isNaN(parsedAlpha)) {
return undefined;
}
return rawAlpha.endsWith('%') ? parsedAlpha / 100 : parsedAlpha;
};
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/react-integration/cypress/integration/drawer.spec.ts` around lines
26 - 37, The rgbSlashAlpha function misinterprets percentage alphas (e.g.,
"50%") because parseFloat returns 50; update rgbSlashAlpha to detect if the
extracted alpha string ends with '%' and, if so, parse the numeric part and
divide by 100 before returning; also trim whitespace, validate the parsed value
and return undefined for NaN or out-of-range values (ensure final alpha is
clamped/validated to 0–1). Reference: rgbSlashAlpha.

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.

Drawer - Glass style follow up

6 participants