Skip to content

Bug - [base-no-reset.css] - container-type: inline-size on :root breaks embedded/guest usage #12568

Description

@its-mitesh-kumar

Describe the problem

base-no-reset.css sets container-type: inline-size and container-name: pf-v6-contain-viewport pf-v6-contain-table on :root (the <html> element). This is a global side effect that breaks applications where PatternFly is used as a guest library (i.e., PF components are rendered inside a host application that owns the document layout).

When container-type: inline-size is applied to <html>, it changes how the root element participates in CSS containment. This breaks the natural <body> height propagation — body.scrollHeight becomes smaller than the viewport height, exposing the browser's default white canvas below the page content. This is especially visible in dark-themed host applications.

The affected file is: @patternfly/react-core/dist/styles/base-no-reset.css

The problematic rule:

:root {
  container-type: inline-size;
  container-name: pf-v6-contain-viewport pf-v6-contain-table;
}

How do you reproduce the problem?

  1. Use a host application with its own theming system (e.g., Backstage/RHDH with a dark theme)
  2. Import @patternfly/react-core/dist/styles/base-no-reset.css in a component
  3. Observe that the <html> element gets container-type: inline-size
  4. The <body> no longer fills the viewport height — a white gap appears at the bottom of the page
  5. In dark-themed applications, this manifests as a white background leak

Expected behavior

base-no-reset.css should NOT apply container-type: inline-size to :root/<html>, or at minimum should scope it to a PatternFly-owned wrapper element. The "no-reset" variant of the base styles is specifically meant for embedded usage where PF does not own the full document — applying global layout mutations defeats that purpose.

If container queries are needed for PF components, the containment context should be set on a PF wrapper element (e.g., .pf-v6-root or similar), not on the document root.

Is this issue blocking you?

We are working around this by explicitly resetting container-type on the <html> element via JavaScript after PF CSS loads:

useLayoutEffect(() => {
  document.documentElement.style.containerType = 'normal';
}, []);

This is not ideal as it's a permanent global mutation to counteract another permanent global mutation.

Screenshots

image

After removing container-type: inline-size

image

What is your environment?

  • OS: macOS

  • Browser: Chrome, Firefox (all browsers affected)

  • PatternFly version: @patternfly/react-core 6.6.0 (introduced between 6.4.3 and 6.6.0)

What is your product and what release date are you targeting?

Red Hat Developer Hub (RHDH) — the Intelligent Assistant plugin uses PatternFly Chatbot components inside a Backstage application.

Any other information?

  • This was not an issue on @patternfly/react-core@6.4.3 — the container-type rule was introduced sometime between 6.4.3 and 6.6.0.

  • The base-no-reset.css variant implies it's safe for embedded use. Adding global containment to :root contradicts that contract.

  • The container-name values (pf-v6-contain-viewport, pf-v6-contain-table) suggest this is for PF's internal @container queries — these should be scoped to a PF-owned container element rather than the document root.


Jira Issue: PF-4453

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions