Enhancement/1868 Update Datepicker #2060
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #1868
mainbranchSummary
SelectorBoxcollapse, fixed a race that caused stale highlighted ranges when only the end date changed, standardized a few style constants, and implemented automatic focus transfer from Start to End field after selecting a start date.Details
In
src/components/common/DatePicker.jsx:divs with semantic<button>elements for the Start and End fields, added ARIA attributes (aria-haspopup,aria-expanded,aria-label), and applied a small button helper class so SVG/icon and hover styles are preserved.& > *) instead of specific selectors, so styles apply to buttons, and introduced a few small local style constants inside the component’smakeStylesto reduce repeated magic numbers (gap, padding, border radius, icon size).endDateBtnRefprop to enable programmatic focus on the End Date button from parent components.In
src/components/common/ReactDayPicker.jsx:pendingSelection) so when the user clicks a date the calendar highlights the new selection immediately while Redux updates are in flight, and implemented logic to computeeffectiveStart/effectiveEnd(preferspendingSelection→ redux props → hoveredenteredTo) to avoid the stale-range bug.pendingSelectionautomatically once connected props match.STYLEobject (minWidth, padding, day max width, nav spacing, pseudo-element extra size).onSelectionComplete(selection)(deferred microtask) so parent can synchronously reconcile store state.handleDayClick: added missingreturnstatements in theactiveField === 'end'branch (after completing end date selection and after treating a click as a new start) to prevent code from falling through to subsequent logic blocks. This bug was causing the selection flow to execute multiple conflicting paths.onSelectionCompletewith the appropriate selection object, including when starting a new range (startDate && endDatecase) and when swapping dates (clicked <startDatecase), enabling proper parent component coordination.In
src/components/DateSelector.jsx:DateSelectoraccept the selection object returned by the calendar and immediately dispatchupdateStartDate/updateEndDateand update its capturedinitialStart/initialEndwhen a selection is completed, then defer closing the collapse to the next microtask (Promise.resolve().then(...)) so Redux/props have a chance to flush before the UI collapses.activeField='end'and programmatically focuses the End Date button usingrequestAnimationFrame(double-buffered for reliable DOM updates). This provides clear visual feedback that the user should proceed to select an end date.endDateBtnRefto enable reliable programmatic focus on the End Date button after start date selection.Notes