feat(Accordion): Added isPlain prop to Accordion#12288
feat(Accordion): Added isPlain prop to Accordion#12288tlabaj wants to merge 5 commits intopatternfly:mainfrom
Conversation
|
Preview: https://pf-react-pr-12288.surge.sh A11y report: https://pf-react-pr-12288-a11y.surge.sh |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughAdds a new optional Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/react-core/src/components/Accordion/Accordion.tsx (1)
34-45:⚠️ Potential issue | 🟠 Major
isPlaindefault broadens behavior beyond explicit opt-out.With Line 34 defaulting
isPlaintofalse, Line 45 appliesnoPlainunder glass theme even when consumers omitisPlain. This conflicts with the “apply whenisPlain={false}” behavior in the PR objective.Proposed fix
export const Accordion: React.FunctionComponent<AccordionProps> = ({ @@ - isPlain = false, + isPlain, @@ - !isPlain && hasGlassTheme() && styles.modifiers.noPlain, + isPlain === false && hasGlassTheme() && styles.modifiers.noPlain,🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/react-core/src/components/Accordion/Accordion.tsx` around lines 34 - 45, The component currently defaults isPlain = false and uses !isPlain in the className, which causes noPlain to be applied when the prop is omitted; update the logic so noPlain is only applied when isPlain is explicitly false. Change the className conditional from !isPlain && hasGlassTheme() to isPlain === false && hasGlassTheme() (or alternatively remove the default and set isPlain to undefined) so styles.modifiers.noPlain is only added when the consumer passed isPlain={false}; reference: prop isPlain, Accordion component, styles.modifiers.noPlain, and hasGlassTheme().
🤖 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/Accordion/__tests__/Accordion.test.tsx`:
- Around line 144-150: The test that adds the 'pf-v6-theme-glass' root class
(test named "Renders with class ${styles.modifiers.noPlain} when isPlain=false
and glass theme is applied") should guard cleanup with a try/finally: add the
class before rendering and put the render/assert inside a try block, then always
remove the class in the finally block to prevent leakage into other tests;
update the test that references Accordion and styles.modifiers.noPlain
accordingly.
---
Outside diff comments:
In `@packages/react-core/src/components/Accordion/Accordion.tsx`:
- Around line 34-45: The component currently defaults isPlain = false and uses
!isPlain in the className, which causes noPlain to be applied when the prop is
omitted; update the logic so noPlain is only applied when isPlain is explicitly
false. Change the className conditional from !isPlain && hasGlassTheme() to
isPlain === false && hasGlassTheme() (or alternatively remove the default and
set isPlain to undefined) so styles.modifiers.noPlain is only added when the
consumer passed isPlain={false}; reference: prop isPlain, Accordion component,
styles.modifiers.noPlain, and hasGlassTheme().
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: b2854331-7f1e-4197-909a-6702d0712ea8
📒 Files selected for processing (3)
packages/react-core/src/components/Accordion/Accordion.tsxpackages/react-core/src/components/Accordion/__tests__/Accordion.test.tsxpackages/react-core/src/helpers/util.ts
What: Closes #12276
isPlainprop is false.hasGlassTheme()utility fucntion to check whetherpf-v6-theme-glassis present on document.documentElement.Summary by CodeRabbit