Skip to content

feat(Page): add dynamic sticky section support#12409

Open
wise-king-sullyman wants to merge 2 commits intopatternfly:mainfrom
wise-king-sullyman:page-section-add-dynamic-sticky-support
Open

feat(Page): add dynamic sticky section support#12409
wise-king-sullyman wants to merge 2 commits intopatternfly:mainfrom
wise-king-sullyman:page-section-add-dynamic-sticky-support

Conversation

@wise-king-sullyman
Copy link
Copy Markdown
Collaborator

@wise-king-sullyman wise-king-sullyman commented May 4, 2026

What: Closes #12330

Assisted-by: Claude Code

Additional issues:

Summary by CodeRabbit

  • New Features

    • Beta sticky positioning for Page components via new stickyBase and isStickyStuck props to enable dynamic sticky behavior.
  • Tests

    • Added unit tests covering sticky-class behavior across prop combinations.
  • Documentation

    • Added a dynamic sticky section example and usage guidance.
  • Chores

    • Bumped PatternFly and related package dependency versions across packages.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 4, 2026

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c1044638-7c5c-4bb4-9676-c1eb3164564a

📥 Commits

Reviewing files that changed from the base of the PR and between 7bad6ee and b111183.

📒 Files selected for processing (5)
  • 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
✅ Files skipped from review due to trivial changes (1)
  • packages/react-styles/package.json
🚧 Files skipped from review as they are similar to previous changes (4)
  • packages/react-tokens/package.json
  • packages/react-docs/package.json
  • packages/react-core/package.json
  • packages/react-icons/package.json

Walkthrough

This PR adds @beta sticky props (stickyBase, isStickyStuck) to PageGroup and PageSection, updates className logic, adds unit tests, provides a dynamic scroll-tracking example and hook, and bumps @patternfly/patternfly prerelease versions across multiple packages.

Changes

Sticky Positioning Feature

Layer / File(s) Summary
Data Shape
packages/react-core/src/components/Page/PageGroup.tsx, packages/react-core/src/components/Page/PageSection.tsx
PageGroupProps and PageSectionProps gain @beta props: stickyBase?: 'top' | 'bottom' and isStickyStuck?: boolean.
Core Implementation
packages/react-core/src/components/Page/PageGroup.tsx, packages/react-core/src/components/Page/PageSection.tsx
Components destructure the new sticky props and conditionally apply CSS modifier classes (stickyTopBase, stickyBottomBase, stickyTopStuck, stickyBottomStuck) based on stickyBase and isStickyStuck.
Example & Hook
packages/react-core/src/components/Page/examples/PageDynamicStickySection.tsx, packages/react-core/src/components/Page/examples/Page.md
New useIsStuckFromScrollParent hook and PageDynamicStickySection example that track scroll parent scrollTop and pass isStickyStuck into PageSection; docs import list updated and new "Dynamic sticky section" subsection added.
Tests
packages/react-core/src/components/Page/__tests__/PageGroup.test.tsx, packages/react-core/src/components/Page/__tests__/PageSection.test.tsx
New unit tests assert sticky modifier class behavior for default, base-only, base+stuck, and stuck-without-base cases.
Documentation & Dependencies
packages/react-core/src/components/Page/examples/Page.md, 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
Markdown docs add "Dynamic sticky section" and reference the example; @patternfly/patternfly bumped from 6.5.0-prerelease.796.5.0-prerelease.80 across packages; @rhds/icons updated in react-icons.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

Needs design review

Suggested reviewers

  • mcoker
  • thatblindgeye
  • kmcfaul
🚥 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(Page): add dynamic sticky section support' directly and specifically describes the main feature addition in the changeset—new sticky section support with dynamic state management.
Linked Issues check ✅ Passed The PR successfully implements all three objectives from issue #12330: adds stickyBase and isStickyStuck props to PageSection and PageGroup [#12330], provides a new example with useIsStuckFromScrollParent hook [#12330], and includes documentation about the new sticky features [#12330].
Out of Scope Changes check ✅ Passed All changes are in scope: sticky-related prop additions and tests, example component, and documentation align with issue #12330 requirements; dependency version bumps are routine maintenance supporting the feature 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

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

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

@patternfly-build
Copy link
Copy Markdown
Collaborator

patternfly-build commented May 4, 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.

🧹 Nitpick comments (2)
packages/react-core/src/components/Page/PageGroup.tsx (1)

57-62: ⚡ Quick win

Consider adding a dev warning when isStickyStuck is set without stickyBase

Both components already follow the pattern of warning via useEffect when a prop combination is a silent no-op (e.g., hasOverflowScroll + no aria-label). isStickyStuck=true without stickyBase applies no CSS classes — a console warning would surface this misconfiguration consistently.

💡 Suggested addition (mirroring the existing pattern)
  useEffect(() => {
    if (hasOverflowScroll && !ariaLabel) {
      /* eslint-disable no-console */
      console.warn('PageGroup: An accessible aria-label is required when hasOverflowScroll is set to true.');
    }
+   if (isStickyStuck && !stickyBase) {
+     /* eslint-disable no-console */
+     console.warn('PageGroup: isStickyStuck has no effect without stickyBase also being set.');
+   }
- }, [hasOverflowScroll, ariaLabel]);
+ }, [hasOverflowScroll, ariaLabel, isStickyStuck, stickyBase]);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/react-core/src/components/Page/PageGroup.tsx` around lines 57 - 62,
The component should emit a dev-time console warning when isStickyStuck is true
but stickyBase is not provided because that prop combination is a silent no-op;
inside the existing useEffect block in PageGroup (or a nearby useEffect that
watches prop combos), add a check for isStickyStuck && !stickyBase and call
console.warn with a clear message (e.g., "PageGroup: isStickyStuck is set to
true but stickyBase is not provided — this will have no effect.") so developers
see the misconfiguration; reference the isStickyStuck and stickyBase props and
ensure the effect depends on [isStickyStuck, stickyBase].
packages/react-core/src/components/Page/PageSection.tsx (1)

117-122: ⚡ Quick win

Same isStickyStuck without stickyBase warning applies here.

Same as PageGroup — consider adding a console.warn inside the existing useEffect when isStickyStuck && !stickyBase to keep the DX pattern consistent across both components.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/react-core/src/components/Page/PageSection.tsx` around lines 117 -
122, In PageSection's useEffect add the same developer experience warning as
PageGroup: when isStickyStuck is true and stickyBase is falsy, call console.warn
to inform developers to provide stickyBase; update the existing effect that
currently checks hasOverflowScroll and ariaLabel (function/component:
PageSection, hook: useEffect, props/vars: hasOverflowScroll, ariaLabel,
isStickyStuck, stickyBase) to also perform a conditional console.warn for
isStickyStuck && !stickyBase so the pattern is consistent across components.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/react-core/src/components/Page/PageGroup.tsx`:
- Around line 57-62: The component should emit a dev-time console warning when
isStickyStuck is true but stickyBase is not provided because that prop
combination is a silent no-op; inside the existing useEffect block in PageGroup
(or a nearby useEffect that watches prop combos), add a check for isStickyStuck
&& !stickyBase and call console.warn with a clear message (e.g., "PageGroup:
isStickyStuck is set to true but stickyBase is not provided — this will have no
effect.") so developers see the misconfiguration; reference the isStickyStuck
and stickyBase props and ensure the effect depends on [isStickyStuck,
stickyBase].

In `@packages/react-core/src/components/Page/PageSection.tsx`:
- Around line 117-122: In PageSection's useEffect add the same developer
experience warning as PageGroup: when isStickyStuck is true and stickyBase is
falsy, call console.warn to inform developers to provide stickyBase; update the
existing effect that currently checks hasOverflowScroll and ariaLabel
(function/component: PageSection, hook: useEffect, props/vars:
hasOverflowScroll, ariaLabel, isStickyStuck, stickyBase) to also perform a
conditional console.warn for isStickyStuck && !stickyBase so the pattern is
consistent across components.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a3d6c913-721c-4f8e-a1ef-1f10fbe9301b

📥 Commits

Reviewing files that changed from the base of the PR and between ed21bd6 and 7bad6ee.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (11)
  • packages/react-core/package.json
  • packages/react-core/src/components/Page/PageGroup.tsx
  • packages/react-core/src/components/Page/PageSection.tsx
  • packages/react-core/src/components/Page/__tests__/PageGroup.test.tsx
  • packages/react-core/src/components/Page/__tests__/PageSection.test.tsx
  • packages/react-core/src/components/Page/examples/Page.md
  • packages/react-core/src/components/Page/examples/PageDynamicStickySection.tsx
  • packages/react-docs/package.json
  • packages/react-icons/package.json
  • packages/react-styles/package.json
  • packages/react-tokens/package.json

@wise-king-sullyman wise-king-sullyman requested review from a team, nicolethoen and thatblindgeye and removed request for a team May 4, 2026 20:41
Copy link
Copy Markdown
Contributor

@thatblindgeye thatblindgeye left a comment

Choose a reason for hiding this comment

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

lgtm, i'd wonder if we'd want to also show the bottom dynamic sticky as well, but not a blocker for this

Copy link
Copy Markdown
Contributor

@nicolethoen nicolethoen left a comment

Choose a reason for hiding this comment

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

LGTM!

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.

PageSection - add updated sticky props & example

4 participants