8000 feat(Accordion): unified theme updates by kmcfaul · Pull Request #8217 · patternfly/patternfly · GitHub
[go: up one dir, main page]

Skip to content

feat(Accordion): unified theme updates#8217

Open
kmcfaul wants to merge 1 commit intopatternfly:mainfrom
kmcfaul:8079-unified-accordion
Open

feat(Accordion): unified theme updates#8217
kmcfaul wants to merge 1 commit intopatternfly:mainfrom
kmcfaul:8079-unified-accordion

Conversation

@kmcfaul
Copy link
Contributor
@kmcfaul kmcfaul commented Mar 12, 2026

Closes #8079

Summary:

  • Separated the toggle background color from the expandable content/before background color
  • Updated expandable content background color to match overall accordion background color (see comment)
  • Updated expandable content margin to match Figma & removed expandable content body padding (was previously split due to differing background colors)
  • Updated expanded toggle padding to be uniform for large variant
  • Updated hover toggle styling to not apply when item is expanded (clicked styling should take precedence)
  • Removed visible margin on expandable content when hidden
  • Added toggle border width for expanded items (HC)
  • Removed expandable content border (HC)

Summary by CodeRabbit

Style

  • Refined accordion component styling for improved visual appearance in expanded states
  • Enhanced spacing and margins throughout expandable content sections for better consistency
  • Improved hover and focus interactions on accordion toggle elements
  • Optimized padding adjustments for large-display accordion variants
  • Updated background color references for better visual coherence

@kmcfaul kmcfaul requested a review from mcoker March 12, 2026 16:12
@coderabbitai
Copy link
Contributor
coderabbitai bot commented Mar 12, 2026

Walkthrough

This PR updates the accordion component's SCSS styling to introduce new CSS custom properties for expanded toggle appearance, refactor expandable content margins and background color references, adjust large-display toggle spacing, and scope hover/focus behavior to non-expanded items.

Changes

Cohort / File(s) Summary
Accordion Styling & Theme Tokens
src/patternfly/components/Accordion/accordion.scss
Added new CSS custom properties for expanded toggle styling (--#{$accordion}__toggle--m-expanded--BackgroundColor, --#{$accordion}__toggle--m-expanded--BorderWidth) and expandable content margins (--#{$accordion}__expandable-content--MarginBlockStart). Updated expandable content background color to reference the top-level accordion token. Adjusted large-display toggle padding from sm to md. Scoped hover/focus rules to non-expanded items and set multiple margin properties to 0 for hidden expandable content.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

Needs design review

Suggested reviewers

  • lboehling
  • mcoker
  • srambach
  • andrew-ronaldson
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title follows conventional commit format with 'feat' prefix and describes the scope (Accordion) and purpose (unified theme updates) clearly.
Linked Issues check ✅ Passed The PR implements unified theme token and style updates for Accordion components as specified in issue #8079, including modified CSS custom properties, expanded state handling, and responsive display contexts.
Out of Scope Changes check ✅ Passed All changes in the accordion.scss file are focused on implementing the unified theme updates specified in issue #8079 with no unrelated modifications detected.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

📝 Coding Plan for PR comments
  • Generate coding plan

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 requested a review from kaylachumley March 12, 2026 16:12

// accordion item
--#{$accordion}__item--BorderRadius: var(--pf-t--global--border--radius--200);
--#{$accordion}__item--m-expanded--BackgroundColor: var(--pf-t--global--background--color--action--plain--clicked); // TODO - remove "m-expanded" in breaking change
Copy link
Contributor Author
@kmcfaul kmcfaul Mar 12, 2026

Choose a reason for hiding this comment

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

This item--m-expanded--BackgroundColor variable is no longer in use with the PR updates. I can either leave it as is, remove it, or refactor the PR to use this variable instead of the newly added --#{$accordion}__toggle--m-expanded--BackgroundColor which I added to replace it (since now only the toggle's background color changes).

@patternfly-build
Copy link
Collaborator
patternfly-build commented Mar 12, 2026

--#{$accordion}__expandable-content--MarginInlineStart: var(--pf-t--global--spacer--md);
--#{$accordion}__expandable-content--BackgroundColor: var(--pf-t--global--background--color--primary--default);
--#{$accordion}__expandable-content--MarginInlineStart: var(--pf-t--global--spacer--lg);
--#{$accordion}__expandable-content--BackgroundColor: var(--#{$accordion}--BackgroundColor);
Copy link
Contributor Author
@kmcfaul kmcfaul Mar 12, 2026

Choose a reason for hiding this comment

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

This expandable-content--BackgroundColor variable may no longer be necessary since the background color of the expandable content should now match the overall background color. Should I remove the background styling entirely here?

Copy link
Contributor
@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 (1)
src/patternfly/components/Accordion/accordion.scss (1)

251-262: Consider adding margin-block-start to transition-property.

The hidden state now resets margin-block-start to 0 (line 252), and the visible state uses the token value (line 262). However, line 274's transition-property only includes margin-block-end, not margin-block-start. If smooth animated transitions for the top margin are intended, consider adding margin-block-start to the transition properties.

If the instant change is intentional (e.g., to prevent visual artifacts during expand/collapse), this is fine as-is.

♻️ Optional: Add margin-block-start to transitions
-  transition-property: opacity, translate, visibility, max-height, margin-block-end;
+  transition-property: opacity, translate, visibility, max-height, margin-block-start, margin-block-end;

Note: You'd also need to add corresponding delay and duration values.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/patternfly/components/Accordion/accordion.scss` around lines 251 - 262,
The transition currently only includes margin-block-end but the hidden state
resets --#{$accordion}__expandable-content--MarginBlockStart while the visible
state uses it, so update the transition-property on
.#{$accordion}__expandable-content to include margin-block-start (alongside
margin-block-end) and ensure you add corresponding transition-duration/-delay
tokens or values consistent with the existing transition for margin-block-end;
target the CSS selector .#{$accordion}__expandable-content (and the hidden
selector .#{$accordion}__expandable-content:where([hidden])) and reference the
token --#{$accordion}__expandable-content--MarginBlockStart when adding the
transition so top-margin changes animate smoothly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/patternfly/components/Accordion/accordion.scss`:
- Around line 251-262: The transition currently only includes margin-block-end
but the hidden state resets
--#{$accordion}__expandable-content--MarginBlockStart while the visible state
uses it, so update the transition-property on .#{$accordion}__expandable-content
to include margin-block-start (alongside margin-block-end) and ensure you add
corresponding transition-duration/-delay tokens or values consistent with the
existing transition for margin-block-end; target the CSS selector
.#{$accordion}__expandable-content (and the hidden selector
.#{$accordion}__expandable-content:where([hidden])) and reference the token
--#{$accordion}__expandable-content--MarginBlockStart when adding the transition
so top-margin changes animate smoothly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: a234ecbb-408e-4143-aa0e-fe49acd27c7f

📥 Commits

Reviewing files that changed from the base of the PR and between 23cb693 and 6bd0af5.

📒 Files selected for processing (1)
  • src/patternfly/components/Accordion/accordion.scss

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.

Accordions - Unified Theme Updates (Core)

2 participants

0