[$175] Spend - Custom range calendar is scrollable in the Spend Date filter
If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.
Version Number: v9.5.27-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://github.com/Expensify/App/pull/105408 Email or phone of affected tester (no customers): n/a Issue reported by: Applause Internal Team Bug source: Pull Request QA execution Device used: Mac 26.5.1 Safari/Chrome App Component: Other
Action Performed:
- Go to https://staging.new.expensify.com
- Navigate to Spend
- Navigate to Filters > Date filter
- Click Custom range
Expected Result:
Both calendars and the Apply button should be fully visible without scrolling
Actual Result:
The Custom range calendar is scrollable in the Date filter under Spend, instead of displaying both calendars and the Apply button without scrolling
Workaround:
Unknown
Platforms:
- [ ] Android: App
- [ ] Android: mWeb Chrome
- [ ] iOS: App
- [ ] iOS: mWeb Safari
- [ ] iOS: mWeb Chrome
- [x] Windows: Chrome
- [x] MacOS: Chrome Safari
Screenshots/Videos
https://github.com/user-attachments/assets/581dc300-70ba-44c5-b488-fb2bcc653642
Applause Internal Information Exported by: Julia Ponikarchuk Bug ID: 7301527
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022116993748016014592
- Upwork Job ID: 2116993748016014592
- Last Price Increase: 2026-11-01
Issue Owner
Current Issue Owner: @getusha
While Applause doesn't embed attachments for this bug, here are the links for quick view: https://platform.applause.com/services/links/v1/external/d2ab6bcda70255c491972b578d746a0f4d6d7f92ad443529d9cfe01350319de7
This PR failing because of the issue #105578
Assigning myself since because this causes failure of the PR I reviewed
Proposal
Please re-state the problem that we are trying to solve in this issue.
In Spend > Filters > Date > Custom range on desktop, both calendars and the Apply button don't fit in the popover, so you have to scroll.
What is the root cause of that problem?
The Filters popover has a fixed height of 520px and a 331px-wide content pane. The date filter inside it always stacks the From and To calendars vertically. Two stacked calendars need about 830px, but only about 400px is available.
- The popover height is fixed at
min(windowHeight, 520). See SearchAdvancedFiltersPopup/index.tsx:295. DateFilterBasehardcodesforceVerticalCalendars. See DateFilterBase.tsx:241.RangeDatePickerstacks the calendars when it is forced vertical. See RangeDatePicker.tsx:31.
Cap the date filter preset list at the dropdown max height did not cause this. It only changed DateSelectPopup, which drives the Date chip in the filter bar. That chip widens to 672px and shows the calendars side by side. The bug is also reproducible in production. QA tested the Filters > Date path, which is a different component.
What changes do you think we should make in order to solve the problem?
When Custom range is selected in the Filters popover, show the calendars side by side, the same way the Date chip does:
- Make
forceVerticalCalendarsa prop ofDateFilterBaseinstead of hardcoding it.DateFilterContentpassesfalseon wide layouts. - While the range view is open, widen the Filters popover content pane to
CONST.POPOVER_DATE_RANGE_WIDTH. This meansSearchAdvancedFiltersPopupmust accept a width override from the selected filter. - Raise the popover height slightly for the range view, to about 540px and capped at
windowHeight. One calendar row with the header and Apply is about 525px.
This changes the popover design, so the design team should confirm it first.
What alternative solutions did you explore? (Optional)
- Keep the stacked layout and raise the popover height to about 900px for the range view. This only helps on tall screens.
- Accept scrolling as expected in this compact popover and close the issue. The filter-bar Date chip already shows both calendars without scrolling.
Reproduction (web, 1440×900)
I opened Spend > Filters > Date > Custom range. The popover is about 520px tall. The From calendar's header and most of its dates sit above the visible area, and the To calendar's last rows are cut off above Apply. The calendars are stacked in the same x-range.
Approximate height math, from style constants:
- Each calendar card is about 405px: the label (~40), the header (50), the weekday row (~45), and 6 × 45 rows.
- The space available is 520 − header (40) − padding (8) − Apply (~72) ≈ 400px.
- Apply is outside the scroll area in DateFilterContent.tsx:40-74, so only the calendars overflow.
The date-chip path, by comparison, uses a 672px width and side-by-side calendars under an 87.5% window-height cap. See DateSelectPopup/index.tsx:115-168.
Next Steps for Contributor+ team:
To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/105578) to create a draft PR.
To refine: @MelvinBot <your feedback>
To reject: Explain why you are rejecting Melvin's proposal.
Current assignee @situchan is eligible for the External assigner, not assigning anyone new.
Job added to Upwork: https://www.upwork.com/jobs/~022116993748016014592
VERDICT: POST
ROOT_CAUSE_ONELINER: In the desktop Custom Range view, the entire two-calendar layout is wrapped inside a ScrollView within a View capped at Math.round(windowHeight * 0.875) — on smaller browser viewports this is insufficient to show both CalendarPicker cards, their "From/To" labels, SelectedDateModifierHeader, and the Apply button without scrolling.
PROPOSAL_TYPE: FIRST
AUTOPOST_SAFE: YES
Proposal
Please re-state the problem that we are trying to solve in this issue.
Spend - Custom range calendar is scrollable in the Spend Date filter
What is the root cause of that problem?
In the Advanced Filters popover (SearchAdvancedFiltersPopup), navigating to Filters > Date > Custom range renders DateFilterContent.tsx, which delegates to DateFilterBase.tsx.
- In
src/components/Search/FilterComponents/DateFilterBase.tsx(line 241),forceVerticalCalendarsis hardcoded totrue. This causesRangeDatePickerto forceisVerticalCalendars = true, stacking the "From" and "To" calendar pickers vertically regardless of viewport width. - Two vertically stacked calendar cards require ~810px of vertical space (each card requires ~405px: label, month navigation, weekday headers, and 6 date rows).
- However,
SearchAdvancedFiltersPopup/index.tsx(line 295) caps the popover height atMath.min(windowHeight, 520)with a 331px-wide content pane. After accounting for the header, margins, and bottom Apply action bar (~120px total), only ~400px of visible height remains. - Because ~810px of stacked calendar content is forced into the ~400px available viewport, the custom range container becomes vertically scrollable.
(Note: PR #105408 modified DateSelectPopup, which drives the filter bar's standalone Date chip, not SearchAdvancedFiltersPopup which handles the Advanced Filters modal).
What changes do you think we should make in order to solve the problem?
To display both calendars and the Apply action cleanly without vertical scrolling on wide layouts:
DateFilterBase.tsx: MakeforceVerticalCalendarsa prop instead of a hardcodedtrue, allowing the caller to control calendar orientation.DateFilterContent.tsx: PassforceVerticalCalendars={isSmallScreenWidth}so desktop and tablet wide layouts can arrange the calendars horizontally.SearchAdvancedFiltersPopup/index.tsx: When the active filter requires a range layout (selectedDateModifier === CONST.SEARCH.DATE_MODIFIERS.RANGE), allow the popover width to dynamically expand toCONST.POPOVER_DATE_RANGE_WIDTH(672px) and set popover height to ~540px (capped atwindowHeight), identical to howDateSelectPopuphandles side-by-side range pickers.
What alternative solutions did you explore? (Optional)
If design intends for SearchAdvancedFiltersPopup to strictly maintain a compact 331px single-column pane across all tabs without dynamic expansion, scrolling the stacked calendars inside ScrollView is expected behavior for compact popovers, and the existing standalone Date chip on the filter bar serves as the side-by-side wide entrypoint.
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01ca8ad8ce36b9eceb
⚠️ Invalid email. Please make sure to create an Expensify account with this email first here.
Proposal
Please re-state the problem that we are trying to solve in this issue.
In Spend > Filters > Date > Custom range on desktop, the "From" and "To" calendars are stacked vertically inside a 331px-wide content pane and require vertical scrolling to view both calendars and the Apply button.
What is the root cause of that problem?
There are two distinct entry points for Date filtering on the Spend page:
-
The Date Filter Chip in the Horizontal Search Bar (
useSearchFiltersBar.tsx->DatePickerFilterPopup.tsx->DateSelectPopup/index.tsx):- When selecting "Custom range",
DateSelectPopupdynamically callssetPopoverWidth(CONST.POPOVER_DATE_RANGE_WIDTH)(672px). forceVerticalCalendarsisfalse, allowingRangeDatePickerto display the "From" and "To" calendars side-by-side inflexDirection: 'row'.- Both calendars and the Apply button fit within the window height without scrolling.
- PR #105408 only touched this component (
src/components/Search/FilterDropdowns/DateSelectPopup/index.tsx), capping only the initial presets list at dropdown max height.
- When selecting "Custom range",
-
The "Filters" Button (Advanced Filters Modal) (
SearchAdvancedFiltersButton.tsx->SearchAdvancedFiltersPopup/index.tsx->DateFilterContent.tsx->DateFilterBase.tsx):- The popover has a fixed outer height capped at
min(windowHeight, CONST.ADVANCED_FILTERS_POPOVER_HEIGHT)(520px) and widthCONST.ADVANCED_FILTERS_POPOVER_WIDTH(582px) with a content pane widthCONST.ADVANCED_FILTERS_CONTENT_WIDTH(331px) (SearchAdvancedFiltersPopup/index.tsx:294-295). - In
DateFilterBase.tsx:241,DatePresetFilterBaseis rendered withforceVerticalCalendars={true}hardcoded (DateFilterBase.tsx:241). - When Custom range is selected,
RangeDatePickerevaluatesshouldStack = forceVertical || isSmallScreenWidthtotrue(RangeDatePicker.tsx:31), forcing vertical stacking. - Two vertically stacked calendar cards (~400px each) + header (~40px) + Apply button (~50px) require >850px of vertical space. Because the container is capped at 520px, the inner
<ScrollView>must scroll to show all content.
- The popover has a fixed outer height capped at
Why was PR #105408 flagged by QA?
In PR #105408, test step 5 instructed: "Open Spend, open the Date filter and repeat steps 2 to 4" (referring to the Date filter chip). During QA regression testing, QA navigated to Spend > Filters (Advanced Filters) > Date > Custom range instead of clicking the Date filter chip in the search bar. PR #105408 never modified SearchAdvancedFiltersPopup or DateFilterBase, and this vertical stacking behavior in Advanced Filters pre-existed in production.
What changes do you think we should make in order to solve the problem?
Depending on product/design approval, there are two paths:
Option A: Allow Side-by-Side Calendars in Advanced Filters Popup (Recommended if zero-scrolling is required)
When "Custom range" is active in SearchAdvancedFiltersPopup, dynamically expand the popover width and allow side-by-side calendars, matching DateSelectPopup:
-
In
src/components/Search/SearchPageHeader/SearchAdvancedFiltersButton.tsx: PasssetPopoverWidthfromPopoverComponentPropsdown toSearchAdvancedFiltersPopup:const filtersPopup = ({closeOverlay, setPopoverWidth}: PopoverComponentProps) => ( <SearchAdvancedFiltersPopup queryJSON={queryJSON} closeOverlay={closeOverlay} filterSearchInputRef={filterSearchInputRef} setPopoverWidth={setPopoverWidth} /> ); -
In
src/components/Search/FilterDropdowns/SearchAdvancedFiltersPopup/index.tsx:- Accept
setPopoverWidth?: (width: number | undefined) => voidinSearchAdvancedFiltersPopupProps. - When the active filter is
DateandselectedDateModifier === CONST.SEARCH.DATE_MODIFIERS.RANGE, widen the popover to accommodate the left panel plus the range picker (CONST.ADVANCED_FILTERS_POPOVER_WIDTH - CONST.ADVANCED_FILTERS_CONTENT_WIDTH + CONST.POPOVER_DATE_RANGE_WIDTH=251 + 672 = 923px), and raise the container height toCONST.POPOVER_DATE_RANGE_HEIGHT(or 540px / dynamic max height). - When exiting Range mode or changing filters, reset
setPopoverWidth(undefined).
- Accept
-
In
src/components/Search/FilterComponents/DateFilterBase.tsx:- Allow
forceVerticalCalendarsto be configurable instead of hardcoded totrue:type DateFilterBaseProps = { ... forceVerticalCalendars?: boolean; }; - In
DateFilterContent.tsx, passforceVerticalCalendars={isSmallScreenWidth}so desktop layouts render calendars side-by-side.
- Allow
What alternative solutions did you explore? (Optional)
Option B: Close Issue as Working as Designed (Clarification for QA & Reviewers)
Vertical scrolling in SearchAdvancedFiltersPopup > Date is intentional because the Advanced Filters content panel is constrained to 331px wide to accommodate the left category navigation list. The Date quick-filter chip in the Spend search bar (DateSelectPopup) already provides side-by-side calendars with zero scrolling. QA tested the wrong component during the PR #105408 regression run. If design prefers maintaining a uniform 582px popover width for Advanced Filters across all filter categories, vertical scrolling is expected and this issue can be closed.
Automated Tests
Unit/UI test for DateFilterBase verifying layout rendering when forceVerticalCalendars is toggled:
import React from 'react';
import {render, screen} from '@testing-library/react-native';
import DateFilterBase from '@components/Search/FilterComponents/DateFilterBase';
import CONST from '@src/CONST';
describe('DateFilterBase', () => {
test('renders calendars side-by-side when forceVerticalCalendars is false on wide screens', () => {
// Given DateFilterBase with Custom range selected and forceVerticalCalendars set to false
const defaultDateValues = {
[CONST.SEARCH.DATE_MODIFIERS.RANGE]: '2026-10-01...2026-10-15',
};
// When rendered with forceVerticalCalendars={false}
render(
<DateFilterBase
defaultDateValues={defaultDateValues}
selectedDateModifier={CONST.SEARCH.DATE_MODIFIERS.RANGE}
forceVerticalCalendars={false}
onSubmit={jest.fn()}
/>,
);
// Then both From and To calendar cards are rendered
expect(screen.getByText('common.from')).toBeTruthy();
expect(screen.getByText('common.to')).toBeTruthy();
});
test('stacks calendars vertically when forceVerticalCalendars is true', () => {
// Given DateFilterBase with Custom range selected and forceVerticalCalendars set to true
const defaultDateValues = {
[CONST.SEARCH.DATE_MODIFIERS.RANGE]: '2026-10-01...2026-10-15',
};
// When rendered with forceVerticalCalendars={true}
render(
<DateFilterBase
defaultDateValues={defaultDateValues}
selectedDateModifier={CONST.SEARCH.DATE_MODIFIERS.RANGE}
forceVerticalCalendars
onSubmit={jest.fn()}
/>,
);
// Then both calendar cards are rendered in stacked vertical layout
expect(screen.getByText('common.from')).toBeTruthy();
expect(screen.getByText('common.to')).toBeTruthy();
});
});
Contributor Details
- Expensify Account Email: [email protected]
- Upwork Profile Link: https://www.upwork.com/freelancers/~014bb7d4c250a1fe03
Proposal
Please re-state the problem that we are trying to solve in this issue.
On desktop, Spend > Filters > Date > Custom range reportedly requires scrolling to access both calendars. The expected behavior is to display both calendars and Apply together when the available viewport can accommodate them.
Audit verdict: refine MelvinBot’s proposal before acceptance. The supplied explanation is plausible, but its proposed dimensions and regression coverage are unverified.
What is the root cause of that problem?
The supplied proposal identifies a mismatch between forced vertical calendars and a height-constrained container:
| Supplied source reference | Claimed behavior |
|---|---|
src/components/Search/FilterComponents/DateFilterBase.tsx:241 |
Forces vertical calendars |
src/components/Search/FilterComponents/RangeDatePicker.tsx:31 |
Selects the vertical layout |
src/components/Search/FilterDropdowns/SearchAdvancedFiltersPopup/index.tsx:295 |
Caps popover height at 520px |
src/components/Search/FilterComponents/AdvancedFilters/DateFilterContent.tsx:40–74 |
Places Apply outside the calendar scroll area |
These references are supplied evidence, not independently verified findings. The pinned source could not be retrieved, no Expensify checkout is available locally, and I did not reproduce the UI. Consequently, neither the estimated 830px content height nor the assertion that PR #105408 is unrelated is established by this audit.
This is a reported layout defect; the supplied evidence establishes no security impact.
What changes do you think we should make in order to solve the problem?
Keep MelvinBot’s direction as a candidate, subject to these implementation requirements:
- Preserve the current default in
DateFilterBase; expose calendar orientation only if the existing API cannot already control it. - Enable horizontal calendars only when the available content width accommodates both calendars. A desktop breakpoint alone does not establish that.
- Scope expanded dimensions to the active Custom range view. Restore normal dimensions when selecting a preset, switching filters, closing, or reopening.
- Include navigation, padding, borders, and anchor positioning when calculating the complete popover width.
- Preserve scrolling when viewport constraints prevent full visibility. Removing overflow would conceal controls.
Do not adopt 540px based on approximate arithmetic. Measure the rendered six-week calendar, header, footer, and spacing before selecting a height.
An exact TypeScript diff cannot responsibly be supplied without inspecting the component types, callers, and sizing implementation. Inventing a callback, prop signature, or line-specific patch would violate the requested evidence standard. No patch, compilation, or passing test result is claimed here.
What alternative solutions did you explore? (Optional)
MelvinBot’s proposal has unresolved acceptance blockers:
- Width accounting: A 672px calendar pane does not establish that the entire Filters popover fits the viewport.
- Height accounting: Approximately 525px of content inside a proposed 540px container leaves little demonstrated allowance for additional spacing or content variation.
- Lifecycle behavior: The proposal does not specify how dimension overrides reset during navigation and reopening.
- Responsive behavior: “Wide layout” does not account for browser zoom, resized windows, or limited space around the anchor.
- Shared-component behavior: Orientation changes require checking other
DateFilterBaseconsumers.
These are review gaps, not empirically demonstrated regressions.
Increasing the vertical popover to roughly 900px fails on shorter viewports. Disabling scrolling risks inaccessible dates or Apply. Closing the issue because the separate Date chip works does not resolve the reported Filters path.
A guarded version of MelvinBot’s approach also risks being a duplicate proposal. Expensify requires new proposals to differ meaningfully from existing ones; additional guards alone do not establish originality. Contribution guidelines
What automated tests can you add to prevent this from re-occurring?
Add focused Jest component tests using the repository’s existing rendering and dimension mocks:
keeps the default calendar orientation for existing consumersuses horizontal calendars when the custom-range content pane has sufficient widthretains vertical calendars when the content pane is too narrowrestores normal dimensions after leaving custom range or reopening the popuppreserves the selected dates when resizing and applies the unchanged range
Jest layout assertions alone cannot prove that scrolling is eliminated. Add a browser regression test using a six-week month and record:
- Calendar-container
scrollHeightandclientHeight. - Bounding rectangles for both calendars, Apply, and the viewport.
- Full visibility without internal vertical overflow at a sufficiently large desktop viewport.
- Reachability of every date and Apply in constrained viewports.
Run the browser case in Chromium and WebKit, including resize and zoom checks. These tests are proposed, not executed; empirical acceptance remains outstanding.
Contributor details
Your Expensify account email: [email protected]
Upwork Profile Link: https://www.upwork.com/freelancers/~01b60d704ba377be83
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01ca8ad8ce36b9eceb
:warning: Unable to store contributor details
Details
Auth SetContributorDetails returned an error 401 Contributor details already exist
Proposal
Please re-state the problem that the issue is trying to solve.
Spend - Custom range calendar is scrollable in the Spend Date filter on wide layouts instead of displaying both calendars and the Apply button without scrolling.
What is the root cause of that problem?
In PR #105408, DateSelectPopup on wide layouts was updated to cap the dropdown height using popoverMaxHeightStyle:
const popoverMaxHeightStyle = selectedDateModifier ? StyleUtils.getMaximumHeight(maxPopupHeight) : styles.getPopoverMaxHeight(windowHeight, isInLandscapeMode);
However, in DateSelectPopup, maxPopupHeight is derived as:
const maxPopupHeight = windowHeight - CONST.DRAWER_SEARCH_HEADER_HEIGHT - CONST.POPOVER_OFFSET;
For DateFilter under Spend/Search (which renders inside a Popover Menu via DatePresetFilter), maxPopupHeight can be constrained or the child <ScrollView> inside DateSelectPopup defaults to scrolling when child content exceeds maxPopupHeight. More importantly, when selectedDateModifier === CONST.SEARCH.DATE_MODIFIERS.RANGE, two side-by-side calendars are rendered requiring vertical breathing room (~520px) without artificial max-height clamping on desktop. When popoverMaxHeightStyle is applied to the root <View>, or when <ScrollView> does not disable scrolling for wide desktop range views, vertical scrollbars appear on the calendar grid.
What changes do you think we should make in order to solve the problem?
In src/components/Search/FilterDropdowns/DateSelectPopup/index.tsx:
- When on wide screen (
!isSmallScreenWidth) anduseRangeLayoutis true (i.e.selectedDateModifier === CONST.SEARCH.DATE_MODIFIERS.RANGE), we should not constrain the popover container withpopoverMaxHeightStyle(or passbounces={false}/ unset maxHeight constraint on range view, letting it size to content or using the full available height without scrolling). Specifically:
const popoverMaxHeightStyle = useRangeLayout
? undefined
: (selectedDateModifier ? StyleUtils.getMaximumHeight(maxPopupHeight) : styles.getPopoverMaxHeight(windowHeight, isInLandscapeMode));
And on the inner <ScrollView> on wide screen:
<ScrollView scrollEnabled={!useRangeLayout}>
This ensures the two calendars and the bottom Apply button fit cleanly on desktop without unnecessary scrollbars, while preserving the max-height capping for single-calendar/preset list views as intended by PR #105408.
What alternative solutions did you explore? (Optional)
Alternatively, we could adjust maxPopupHeight calculation specifically when useRangeLayout is active, but unconstraining maxHeight for the horizontal dual-calendar view (useRangeLayout) is much cleaner and eliminates any scroll clipping across screen resolutions.
Tests
- Open Spend on a wide desktop window (Mac/Windows Chrome).
- Click on the Date filter.
- Click "Custom range".
- Verify that both calendars and the bottom Range text / Apply button are fully visible without any vertical scrollbar.
- Verify that clicking "Custom date" or opening the preset date list still maintains proper sizing and scrolling behavior if needed.
[✓] Verify that no errors appear in the JS console
Offline tests
- Go offline.
- Open Date filter under Spend, click "Custom range".
- Verify both calendars display properly without unexpected scrolling.
QA Steps
Same as Tests.
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~016c1aa34b51059d42
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Proposal
Please re-state the problem that we are trying to solve in this issue.
In Spend > Filters > Date > Custom range on desktop, the From and To calendars and the Apply button don't fit in the Filters popover, so the user has to scroll to reach the second calendar and Apply.
What is the root cause of that problem?
The range view always draws two full calendars stacked vertically inside a pane that is sized for one.
-
src/components/Search/FilterDropdowns/SearchAdvancedFiltersPopup/index.tsx:295-296gives the popover a fixed height and a narrow content pane:<View style={[styles.flexRow, StyleUtils.getHeight(Math.min(windowHeight, CONST.ADVANCED_FILTERS_POPOVER_HEIGHT))]}> <View style={[styles.typeFiltersPopupContainer, StyleUtils.getWidthStyle(CONST.ADVANCED_FILTERS_POPOVER_WIDTH - CONST.ADVANCED_FILTERS_CONTENT_WIDTH)]}> -
src/components/Search/FilterComponents/DateFilterBase.tsx:241always forces vertical calendars, because the 331px pane is too narrow to put them side by side:<DatePresetFilterBase ... forceVerticalCalendars /> -
src/components/Search/FilterComponents/RangeDatePicker.tsx:36-61then renders bothCalendarPickers, one under the other, each in its own bordered card with a label:const shouldStack = forceVertical || isSmallScreenWidth; ... <CalendarPicker value={fromDate} ... /> ... <CalendarPicker value={toDate} ... />Two calendar cards are about twice the height the pane has left after the header and the Apply row. So the
ScrollViewatDateFilterBase.tsx:227scrolls.
The narrow pane forces stacking, and stacking needs twice the height. No pane size fixes both at once without changing the popover's design.
What changes do you think we should make in order to solve the problem?
In the compact Filters pane, show one calendar at a time with a From / To switcher above it, instead of two stacked calendars. The popover keeps its current size, so its design doesn't change, and the side-by-side layout stays where it fits (the filter-bar Date chip).
-
In
RangeDatePicker.tsx, add a single-calendar mode with an active field:type RangeDatePickerProps = { ... /** Show one calendar at a time, with a From / To switcher, for panes too short for two */ shouldShowSingleCalendar?: boolean; }; const [activeField, setActiveField] = useState<'from' | 'to'>('from'); -
Render the switcher plus one calendar when that mode is on. Picking a From date moves straight to To, so a range still takes two clicks:
if (shouldShowSingleCalendar) { const isFrom = activeField === 'from'; return ( <View style={styles.mh5}> <View style={[styles.flexRow, styles.gap2, styles.mb3]}> <RangeFieldButton label={translate('common.from')} value={fromValue} isActive={isFrom} onPress={() => setActiveField('from')} /> <RangeFieldButton label={translate('common.to')} value={toValue} isActive={!isFrom} onPress={() => setActiveField('to')} /> </View> <CalendarPicker key={activeField} value={isFrom ? fromDate : toDate} onSelected={(date) => { const formatted = format(date, CONST.DATE.FNS_FORMAT_STRING); if (isFrom) { onFromSelected(formatted); setActiveField('to'); return; } onToSelected(formatted); }} isDateSelectable={(date) => DateUtils.isWithinCalendarPickerRange(date) && (isFrom ? !toDate || date <= toDate : !fromDate || date >= fromDate)} headerContainerStyle={styles.ph4} /> </View> ); }RangeFieldButtonis a small pressable showing the label and the selected date, styled like the existing bordered card (styles.borderedContentCard), with the active one highlighted. TheisDateSelectablerules anddefaultMonthlogic are the same as today's two calendars, so From can never pass To. -
Pass the mode through
DatePresetFilterBasefromDateFilterBase.tsx:241, the only caller that forces vertical calendars:<DatePresetFilterBase ... forceVerticalCalendars shouldShowSingleRangeCalendar />Narrow layouts (mobile RHP) and the filter-bar Date chip don't pass it, so they keep their current layouts.
-
One calendar with the switcher is about half the height of the current stack, so the calendar, the range summary and Apply fit in the 520px popover without scrolling. The
ScrollViewstays as a fallback for very short windows (Math.min(windowHeight, 520)).
What alternative solutions did you explore? (Optional)
- Widen the popover to 672px and show the calendars side by side for Custom range. This changes the popover's size while the user is inside it. It needs a width override passed up from the selected filter, plus design sign-off.
- Raise the popover height for the range view. Two stacked calendars need roughly 850px, so this only helps on tall screens.
Automated Tests
In tests/ui/RangeDatePickerTest.tsx:
- Given
shouldShowSingleCalendar. When it renders. Then only oneCalendarPickeris shown and the From field is active. - When a From date is picked. Then
onFromSelectedis called and the To field becomes active. - Given a selected From date. When the To calendar renders. Then dates before From can't be selected.
- Given no
shouldShowSingleCalendar. When it renders. Then both calendars render as today.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Spend - Custom range calendar is scrollable in the Spend Date filter on desktop.
What is the root cause of that problem?
In the Advanced Filters popover (SearchAdvancedFiltersPopup), navigating to Filters > Date > Custom range renders DateFilterContent.tsx, which delegates to DateFilterBase.tsx.
- In
src/components/Search/FilterComponents/DateFilterBase.tsx(line 241),DatePresetFilterBasehasforceVerticalCalendarshardcoded totrue. - When the Custom range modifier is selected,
RangeDatePickerevaluatesshouldStack = forceVertical || isSmallScreenWidthtotrue, forcing the "From" and "To" calendars to stack vertically one on top of the other. - Two vertically stacked calendar cards require ~810px of vertical space (~405px per card including label, month navigation, weekday headers, and 6 date rows) plus header and Apply button (~900px total).
- However,
SearchAdvancedFiltersPopup/index.tsxcaps the popover height atMath.min(windowHeight, CONST.ADVANCED_FILTERS_POPOVER_HEIGHT)(520px) with a 331px content width. After accounting for the filter title header, padding, and bottom Apply container, only ~400px of visible height remains. - Because ~900px of stacked content is rendered into ~400px of space, the inner
ScrollViewinDateFilterBaseis forced to scroll vertically.
(Note: In contrast, the standalone Date chip on the search bar rendered by DateSelectPopup dynamically sets its width to CONST.POPOVER_DATE_RANGE_WIDTH (672px) with forceVerticalCalendars={false}, displaying the two calendars side by side without scrolling).
What changes do you think we should make in order to solve the problem?
To provide a clean, non-scrolling experience on desktop/wide screens:
-
DateFilterBase.tsx: MakeforceVerticalCalendarsan optional prop instead of hardcoding it totrue:type DateFilterBaseProps = { ... forceVerticalCalendars?: boolean; }; -
DateFilterContent.tsx: PassforceVerticalCalendars={isSmallScreenWidth}so desktop and tablet screens allow horizontal side-by-side rendering. -
SearchAdvancedFiltersPopup/index.tsx&SearchAdvancedFiltersButton.tsx: PasssetPopoverWidthfromPopoverComponentPropsintoSearchAdvancedFiltersPopup. WhenselectedDateModifier === CONST.SEARCH.DATE_MODIFIERS.RANGE, dynamically adjust the popover container width to accommodate the category sidebar plus the side-by-side range picker (CONST.ADVANCED_FILTERS_POPOVER_WIDTH - CONST.ADVANCED_FILTERS_CONTENT_WIDTH + CONST.POPOVER_DATE_RANGE_WIDTH), and set height toCONST.POPOVER_DATE_RANGE_HEIGHT(capped atwindowHeight), exactly matchingDateSelectPopup. When navigating away from Range, reset width back to default.
What alternative solutions did you explore? (Optional)
- Interactive From/To Switcher: If product/design strictly requires the Advanced Filters content pane to remain 331px wide across all tabs,
RangeDatePickercan render a segmented control / tab switcher (From|To) displaying one calendar at a time. Picking theFromdate auto-switches toTo. This cuts the vertical requirement in half (~430px) and easily fits inside the 520px container without any scrolling. - Accept Scrolling in Compact Modal: If design prefers keeping the 582px overall popover width unchanged and considers vertical scrolling normal for multi-step advanced filters, the issue can be clarified with design as working as intended (since the primary horizontal quick-filter chip already offers non-scrolling side-by-side calendars).
Automated Tests
Add unit tests in tests/unit/DateFilterBaseTest.tsx:
- Verify
DateFilterBaserenders horizontal calendars whenforceVerticalCalendars={false}andisSmallScreenWidth={false}. - Verify
DateFilterBaserenders stacked vertical calendars whenforceVerticalCalendars={true}or on small screens.
Manual Tests
- Open Expensify on desktop and navigate to Spend.
- Click Filters to open the Advanced Filters popover.
- Click on Date, then click Custom range.
- Verify that both the From and To calendars and the Apply button are visible without needing to scroll.
- Resize window to mobile viewport width: verify calendars stack vertically inside the scrollable container.
Contributor details
Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~0105126232377c4c5c
✅ Contributor details stored successfully. Thank you for contributing to Expensify!