File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
packages/react-core/src/components/DatePicker Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -236,7 +236,12 @@ const DatePickerBase = (
236236 ) ;
237237 const focusSelectorForUnselectedDate = createFocusSelectorString ( calendarMonthStyles . modifiers . current ) ;
238238
239- const getElementToFocus = ( ) => {
239+ /**
240+ * Returns a CSS selector for a date button element which will receive initial focus after opening calendar popover.
241+ * In case of a range picker it returns the end date, if it is selected, start date otherwise.
242+ * In case of a normal datepicker it returns the selected date, if present, today otherwise.
243+ */
244+ const getElementSelectorToFocus = ( ) => {
240245 if ( isValidDate ( valueDate ) && isValidDate ( rangeStart ) ) {
241246 return focusSelectorForSelectedEndRangeDate ;
242247 }
@@ -249,7 +254,7 @@ const DatePickerBase = (
249254 return (
250255 < div className = { css ( styles . datePicker , className ) } ref = { datePickerWrapperRef } style = { style } { ...props } >
251256 < Popover
252- elementToFocus = { getElementToFocus ( ) }
257+ elementToFocus = { getElementSelectorToFocus ( ) }
253258 position = "bottom"
254259 bodyContent = {
255260 < CalendarMonth
You can’t perform that action at this time.
0 commit comments