Skip to content

Card body background stays white in dark mode (PF Card dark theme tokens not applied) #24

@vishsanghishetty

Description

@vishsanghishetty

Description

When using WidgetLayout with PF v6 dark theme (pf-v6-theme-dark on <html>), the card body background remains white. The card header renders correctly with a dark background, but the <CardBody> area stays light.

Individual PF components render correctly in dark mode outside of the widgetized-dashboard wrapper. The issue is specific to how cards render inside react-grid-layout grid items.

Environment

  • @patternfly/widgetized-dashboard: 1.0.0-prerelease.6
  • @patternfly/react-core: 6.4.0
  • @patternfly/patternfly: 6.4.0
  • Storybook 8 with @storybook/addon-themes (withThemeByClassName, parentSelector: 'html')

Steps to reproduce

  1. Set up a Storybook with PF dark theme toggle using withThemeByClassName
  2. Render a WidgetLayout with any widgets
  3. Toggle to dark mode

Expected

Card body background should use --pf-t--global--background--color--primary--default (resolves to gray-80 in dark mode).

Actual

Card body remains white. The PF Card's background-color: var(--pf-v6-c-card--BackgroundColor) doesn't pick up the dark mode token override.

Possible cause

react-grid-layout renders grid items with inline positioning styles that may create a context where PF's :root:where(.pf-v6-theme-dark) token overrides don't cascade into the Card's computed styles. The card header works because styles.css explicitly sets background: var(--pf-t--global--background--color--secondary--default) on .pf-v6-widget-grid-tile__header.

Workaround

None found yet. The previous issue #15 was closed with PR #19, but the card body dark mode regression persists in prerelease.6.

Screenshots

Card header is dark, body is white in dark mode:

(screenshots can be added)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions