feat(CalendarMonth): add select appendTo passthrough#12391
feat(CalendarMonth): add select appendTo passthrough#12391thatblindgeye merged 3 commits intopatternfly:mainfrom
Conversation
WalkthroughAdds an optional ChangesCalendarMonth Component
Sequence Diagram(s)sequenceDiagram
participant CalendarMonth
participant Select
participant DOM
CalendarMonth->>Select: provide popperProps.appendTo = monthAppendTo
Select->>DOM: append popper menu to monthAppendTo container
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 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 |
|
Preview: https://pf-react-pr-12391.surge.sh A11y report: https://pf-react-pr-12391-a11y.surge.sh |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/CalendarMonth/CalendarMonth.tsx`:
- Around line 84-85: The prop type for monthSelectProps is too strict (it uses
SelectProps which requires toggle); change the declaration of monthSelectProps
to use Partial<SelectProps> so callers can pass only subsets like popperProps.
Update the type on the CalendarMonth component/interface (the monthSelectProps
property) and adjust any usage sites that assume required fields (e.g., avoid
directly calling monthSelectProps.toggle without existence checks) to handle
possibly-undefined members after making it Partial.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a5e62b52-f57d-4114-8cf4-5182be9d70f3
📒 Files selected for processing (1)
packages/react-core/src/components/CalendarMonth/CalendarMonth.tsx
| /** Additional props passed to the month select component. */ | ||
| monthSelectProps?: SelectProps; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Verify SelectProps requires toggle
rg -n --type=ts 'export interface SelectProps|toggle:\s*SelectToggleProps' packages/react-core/src/components/Select/Select.tsx
# Verify CalendarMonth typing for monthSelectProps
rg -n --type=ts 'monthSelectProps\?:\s*SelectProps|monthSelectProps\?:\s*Partial<SelectProps>' packages/react-core/src/components/CalendarMonth/CalendarMonth.tsxRepository: patternfly/patternfly-react
Length of output: 260
monthSelectProps requires the full SelectProps interface, blocking partial passthrough use-cases
Line 85 types monthSelectProps as SelectProps, which has a required toggle property. This prevents callers from passing only specific options like popperProps, making the API ergonomically awkward for typical passthrough scenarios.
Change to Partial<SelectProps> to allow flexible prop passthrough:
Suggested fix
- monthSelectProps?: SelectProps;
+ monthSelectProps?: Partial<SelectProps>;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| /** Additional props passed to the month select component. */ | |
| monthSelectProps?: SelectProps; | |
| /** Additional props passed to the month select component. */ | |
| monthSelectProps?: Partial<SelectProps>; |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/react-core/src/components/CalendarMonth/CalendarMonth.tsx` around
lines 84 - 85, The prop type for monthSelectProps is too strict (it uses
SelectProps which requires toggle); change the declaration of monthSelectProps
to use Partial<SelectProps> so callers can pass only subsets like popperProps.
Update the type on the CalendarMonth component/interface (the monthSelectProps
property) and adjust any usage sites that assume required fields (e.g., avoid
directly calling monthSelectProps.toggle without existence checks) to handle
possibly-undefined members after making it Partial.
2caf68f to
9e3578f
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@packages/react-core/src/components/CalendarMonth/CalendarMonth.tsx`:
- Around line 84-89: The JSDoc examples incorrectly use menuAppendTo instead of
the actual prop monthAppendTo; update the doc block for the CalendarMonth
component (the JSDoc above the monthAppendTo prop) to use monthAppendTo in all
example lines (e.g. monthAppendTo={() => document.body} and
monthAppendTo={document.getElementById('target')}) so the examples match the
public API and avoid misleading consumers.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: eab2bad0-c8d7-4aad-897d-b02405b0716a
📒 Files selected for processing (1)
packages/react-core/src/components/CalendarMonth/CalendarMonth.tsx
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@packages/react-core/src/components/CalendarMonth/CalendarMonth.tsx`:
- Around line 84-90: Add a new prop monthSelectProps to the CalendarProps
interface and use it in CalendarMonth to pass-through and allow overriding all
Select and popperProps options instead of only mapping monthAppendTo to
popperProps.appendTo; specifically, update the CalendarMonth component so it
merges monthSelectProps into the Select invocation (preserving existing
controlled props) and merges popperProps such that monthSelectProps.popperProps
takes precedence, falling back to monthAppendTo when no appendTo is provided,
and ensure other popperProps (placement, strategy, etc.) are forwarded
unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 31a24d0a-f28a-4529-bcf4-56399d4ecc01
📒 Files selected for processing (1)
packages/react-core/src/components/CalendarMonth/CalendarMonth.tsx
|
Your changes have been released in:
Thanks for your contribution! 🎉 |
What: Closes #12414
Allows a user to override the select
appendToif their user case requires a different configuration.Summary by CodeRabbit