App icon indicating copy to clipboard operation
App copied to clipboard

[$175] Spend - Custom range calendar is scrollable in the Spend Date filter

Open applause-bot[bot] opened this issue 1 month ago • 45 comments

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:

  1. Go to https://staging.new.expensify.com
  2. Navigate to Spend
  3. Navigate to Filters > Date filter
  4. 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

View all open jobs on GitHub

Applause Internal Information Exported by: Julia Ponikarchuk Bug ID: 7301527

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @getusha

applause-bot[bot] avatar Nov 01 '26 20:11 applause-bot[bot]

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

applause-bot[bot] avatar Nov 01 '26 20:11 applause-bot[bot]

This PR failing because of the issue #105578

Assigning myself since because this causes failure of the PR I reviewed

situchan avatar Nov 01 '26 20:11 situchan

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.

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:

  1. Make forceVerticalCalendars a prop of DateFilterBase instead of hardcoding it. DateFilterContent passes false on wide layouts.
  2. While the range view is open, widen the Filters popover content pane to CONST.POPOVER_DATE_RANGE_WIDTH. This means SearchAdvancedFiltersPopup must accept a width override from the selected filter.
  3. 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.

Custom range in the Filters popover: stacked calendars overflow the 520px popover

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.


view run · view recording

MelvinBot avatar Nov 01 '26 20:11 MelvinBot

Current assignee @situchan is eligible for the External assigner, not assigning anyone new.

melvin-bot[bot] avatar Nov 01 '26 20:11 melvin-bot[bot]

Job added to Upwork: https://www.upwork.com/jobs/~022116993748016014592

melvin-bot[bot] avatar Nov 01 '26 20:11 melvin-bot[bot]

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

j3ffffff avatar Nov 01 '26 20:11 j3ffffff

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.

  1. In src/components/Search/FilterComponents/DateFilterBase.tsx (line 241), forceVerticalCalendars is hardcoded to true. This causes RangeDatePicker to force isVerticalCalendars = true, stacking the "From" and "To" calendar pickers vertically regardless of viewport width.
  2. Two vertically stacked calendar cards require ~810px of vertical space (each card requires ~405px: label, month navigation, weekday headers, and 6 date rows).
  3. However, SearchAdvancedFiltersPopup/index.tsx (line 295) caps the popover height at Math.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.
  4. 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:

  1. DateFilterBase.tsx: Make forceVerticalCalendars a prop instead of a hardcoded true, allowing the caller to control calendar orientation.
  2. DateFilterContent.tsx: Pass forceVerticalCalendars={isSmallScreenWidth} so desktop and tablet wide layouts can arrange the calendars horizontally.
  3. SearchAdvancedFiltersPopup/index.tsx: When the active filter requires a range layout (selectedDateModifier === CONST.SEARCH.DATE_MODIFIERS.RANGE), allow the popover width to dynamically expand to CONST.POPOVER_DATE_RANGE_WIDTH (672px) and set popover height to ~540px (capped at windowHeight), identical to how DateSelectPopup handles 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.

apoorv-xs avatar Nov 01 '26 20:11 apoorv-xs

Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01ca8ad8ce36b9eceb

apoorv-xs avatar Nov 01 '26 20:11 apoorv-xs

⚠️ Invalid email. Please make sure to create an Expensify account with this email first here.

melvin-bot[bot] avatar Nov 01 '26 20:11 melvin-bot[bot]

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:

  1. The Date Filter Chip in the Horizontal Search Bar (useSearchFiltersBar.tsx -> DatePickerFilterPopup.tsx -> DateSelectPopup/index.tsx):

    • When selecting "Custom range", DateSelectPopup dynamically calls setPopoverWidth(CONST.POPOVER_DATE_RANGE_WIDTH) (672px).
    • forceVerticalCalendars is false, allowing RangeDatePicker to display the "From" and "To" calendars side-by-side in flexDirection: '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.
  2. 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 width CONST.ADVANCED_FILTERS_POPOVER_WIDTH (582px) with a content pane width CONST.ADVANCED_FILTERS_CONTENT_WIDTH (331px) (SearchAdvancedFiltersPopup/index.tsx:294-295).
    • In DateFilterBase.tsx:241, DatePresetFilterBase is rendered with forceVerticalCalendars={true} hardcoded (DateFilterBase.tsx:241).
    • When Custom range is selected, RangeDatePicker evaluates shouldStack = forceVertical || isSmallScreenWidth to true (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.

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:

  1. In src/components/Search/SearchPageHeader/SearchAdvancedFiltersButton.tsx: Pass setPopoverWidth from PopoverComponentProps down to SearchAdvancedFiltersPopup:

    const filtersPopup = ({closeOverlay, setPopoverWidth}: PopoverComponentProps) => (
        <SearchAdvancedFiltersPopup
            queryJSON={queryJSON}
            closeOverlay={closeOverlay}
            filterSearchInputRef={filterSearchInputRef}
            setPopoverWidth={setPopoverWidth}
        />
    );
    
  2. In src/components/Search/FilterDropdowns/SearchAdvancedFiltersPopup/index.tsx:

    • Accept setPopoverWidth?: (width: number | undefined) => void in SearchAdvancedFiltersPopupProps.
    • When the active filter is Date and selectedDateModifier === 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 to CONST.POPOVER_DATE_RANGE_HEIGHT (or 540px / dynamic max height).
    • When exiting Range mode or changing filters, reset setPopoverWidth(undefined).
  3. In src/components/Search/FilterComponents/DateFilterBase.tsx:

    • Allow forceVerticalCalendars to be configurable instead of hardcoded to true:
      type DateFilterBaseProps = {
          ...
          forceVerticalCalendars?: boolean;
      };
      
    • In DateFilterContent.tsx, pass forceVerticalCalendars={isSmallScreenWidth} so desktop layouts render calendars side-by-side.

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

Abdibaye avatar Nov 01 '26 21:11 Abdibaye

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:

  1. Preserve the current default in DateFilterBase; expose calendar orientation only if the existing API cannot already control it.
  2. Enable horizontal calendars only when the available content width accommodates both calendars. A desktop breakpoint alone does not establish that.
  3. Scope expanded dimensions to the active Custom range view. Restore normal dimensions when selecting a preset, switching filters, closing, or reopening.
  4. Include navigation, padding, borders, and anchor positioning when calculating the complete popover width.
  5. 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 DateFilterBase consumers.

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 consumers
  • uses horizontal calendars when the custom-range content pane has sufficient width
  • retains vertical calendars when the content pane is too narrow
  • restores normal dimensions after leaving custom range or reopening the popup
  • preserves 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 scrollHeight and clientHeight.
  • 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

camesenin avatar Nov 01 '26 21:11 camesenin

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

melvin-bot[bot] avatar Nov 01 '26 21:11 melvin-bot[bot]

Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01ca8ad8ce36b9eceb

apoorv-xs avatar Nov 01 '26 21:11 apoorv-xs

:warning: Unable to store contributor details

Details
Auth SetContributorDetails returned an error
401 Contributor details already exist

melvin-bot[bot] avatar Nov 01 '26 21:11 melvin-bot[bot]

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:

  1. When on wide screen (!isSmallScreenWidth) and useRangeLayout is true (i.e. selectedDateModifier === CONST.SEARCH.DATE_MODIFIERS.RANGE), we should not constrain the popover container with popoverMaxHeightStyle (or pass bounces={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

  1. Open Spend on a wide desktop window (Mac/Windows Chrome).
  2. Click on the Date filter.
  3. Click "Custom range".
  4. Verify that both calendars and the bottom Range text / Apply button are fully visible without any vertical scrollbar.
  5. 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

  1. Go offline.
  2. Open Date filter under Spend, click "Custom range".
  3. Verify both calendars display properly without unexpected scrolling.

QA Steps

Same as Tests.

bhomvratrai-glitch avatar Nov 01 '26 22:11 bhomvratrai-glitch

Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~016c1aa34b51059d42

bhomvratrai-glitch avatar Nov 01 '26 22:11 bhomvratrai-glitch

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

melvin-bot[bot] avatar Nov 01 '26 22:11 melvin-bot[bot]

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.

  1. src/components/Search/FilterDropdowns/SearchAdvancedFiltersPopup/index.tsx:295-296 gives 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)]}>
    
  2. src/components/Search/FilterComponents/DateFilterBase.tsx:241 always forces vertical calendars, because the 331px pane is too narrow to put them side by side:

    <DatePresetFilterBase
        ...
        forceVerticalCalendars
    />
    
  3. src/components/Search/FilterComponents/RangeDatePicker.tsx:36-61 then renders both CalendarPickers, 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 ScrollView at DateFilterBase.tsx:227 scrolls.

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).

  1. 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');
    
  2. 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>
        );
    }
    

    RangeFieldButton is a small pressable showing the label and the selected date, styled like the existing bordered card (styles.borderedContentCard), with the active one highlighted. The isDateSelectable rules and defaultMonth logic are the same as today's two calendars, so From can never pass To.

  3. Pass the mode through DatePresetFilterBase from DateFilterBase.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.

  4. 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 ScrollView stays 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 one CalendarPicker is shown and the From field is active.
  • When a From date is picked. Then onFromSelected is 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.

voxturrlabs avatar Nov 02 '26 05:11 voxturrlabs

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.

  1. In src/components/Search/FilterComponents/DateFilterBase.tsx (line 241), DatePresetFilterBase has forceVerticalCalendars hardcoded to true.
  2. When the Custom range modifier is selected, RangeDatePicker evaluates shouldStack = forceVertical || isSmallScreenWidth to true, forcing the "From" and "To" calendars to stack vertically one on top of the other.
  3. 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).
  4. However, SearchAdvancedFiltersPopup/index.tsx caps the popover height at Math.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.
  5. Because ~900px of stacked content is rendered into ~400px of space, the inner ScrollView in DateFilterBase is 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:

  1. DateFilterBase.tsx: Make forceVerticalCalendars an optional prop instead of hardcoding it to true:

    type DateFilterBaseProps = {
        ...
        forceVerticalCalendars?: boolean;
    };
    
  2. DateFilterContent.tsx: Pass forceVerticalCalendars={isSmallScreenWidth} so desktop and tablet screens allow horizontal side-by-side rendering.

  3. SearchAdvancedFiltersPopup/index.tsx & SearchAdvancedFiltersButton.tsx: Pass setPopoverWidth from PopoverComponentProps into SearchAdvancedFiltersPopup. When selectedDateModifier === 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 to CONST.POPOVER_DATE_RANGE_HEIGHT (capped at windowHeight), exactly matching DateSelectPopup. When navigating away from Range, reset width back to default.

What alternative solutions did you explore? (Optional)

  1. Interactive From/To Switcher: If product/design strictly requires the Advanced Filters content pane to remain 331px wide across all tabs, RangeDatePicker can render a segmented control / tab switcher (From | To) displaying one calendar at a time. Picking the From date auto-switches to To. This cuts the vertical requirement in half (~430px) and easily fits inside the 520px container without any scrolling.
  2. 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 DateFilterBase renders horizontal calendars when forceVerticalCalendars={false} and isSmallScreenWidth={false}.
  • Verify DateFilterBase renders stacked vertical calendars when forceVerticalCalendars={true} or on small screens.

Manual Tests

  1. Open Expensify on desktop and navigate to Spend.
  2. Click Filters to open the Advanced Filters popover.
  3. Click on Date, then click Custom range.
  4. Verify that both the From and To calendars and the Apply button are visible without needing to scroll.
  5. 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

ayolyn avatar Nov 02 '26 10:11 ayolyn

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

melvin-bot[bot] avatar Nov 02 '26 10:11 melvin-bot[bot]