@@ -22,7 +22,7 @@ export interface DatePickerProps
22
22
* menuAppendTo={() => document.body};
23
23
* menuAppendTo={document.getElementById('target')}
24
24
*/
25
- appendTo ?: HTMLElement | ( ( ref ?: HTMLElement ) => HTMLElement ) | 'parent ' ;
25
+ appendTo ?: HTMLElement | ( ( ref ?: HTMLElement ) => HTMLElement ) | 'inline ' ;
26
26
/** Accessible label for the date picker. */
27
27
'aria-label' ?: string ;
28
28
/** Accessible label for the button to open the date picker. */
@@ -95,7 +95,7 @@ const DatePickerBase = (
95
95
onBlur = ( ) : any => undefined ,
96
96
invalidFormatText = 'Invalid date' ,
97
97
helperText,
98
- appendTo = 'parent ' ,
98
+ appendTo = 'inline ' ,
99
99
popoverProps,
100
100
monthFormat,
101
101
weekdayFormat,
@@ -120,6 +120,7 @@ const DatePickerBase = (
120
120
const style = { '--pf-c-date-picker__input--c-form-control--width-chars' : widthChars , ...styleProps } ;
121
121
const buttonRef = React . useRef < HTMLButtonElement > ( ) ;
122
122
const datePickerWrapperRef = React . useRef < HTMLDivElement > ( ) ;
123
+ const inputGroupRef = React . useRef < HTMLDivElement > ( ) ;
123
124
124
125
React . useEffect ( ( ) => {
125
126
setValue ( valueProp ) ;
@@ -197,8 +198,7 @@ const DatePickerBase = (
197
198
[ setPopoverOpen , popoverOpen , selectOpen ]
198
199
) ;
199
200
200
- const getParentElement = ( ) =>
201
- datePickerWrapperRef && datePickerWrapperRef . current ? datePickerWrapperRef . current : null ;
201
+ const getInlineParentElement = ( ) => inputGroupRef ?. current ;
202
202
203
203
return (
204
204
< div className = { css ( styles . datePicker , className ) } ref = { datePickerWrapperRef } style = { style } { ...props } >
@@ -243,11 +243,11 @@ const DatePickerBase = (
243
243
withFocusTrap
244
244
hasNoPadding
245
245
hasAutoWidth
246
- appendTo = { appendTo === 'parent ' ? getParentElement ( ) : appendTo }
246
+ appendTo = { appendTo === 'inline ' ? getInlineParentElement ( ) : appendTo }
247
247
{ ...popoverProps }
248
248
>
249
249
< div className = { styles . datePickerInput } >
250
- < InputGroup >
250
+ < InputGroup innerRef = { inputGroupRef } >
251
251
< TextInput
252
252
isDisabled = { isDisabled }
253
253
aria-label = { ariaLabel }
0 commit comments