Skip to content

[Due for payment 2025-07-04] [$250] reports-From and date bottom modal able to be opened together by tapping both tabs quickly. #63409

Closed

Description

@mitarachim

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: v9.1.56-9
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: N/a
Email or phone of affected tester (no customers): slottwo1gcd1@gmail.com
Issue reported by: Applause Internal Team
Device used: Redminote 10s android 13 phone
App Component: User Settings

Action Performed:

  1. Launch app
  2. Go to reports
  3. Tap from and date dropdown quickly

Expected Result:

From and date bottom modal must not be able to be opened together by tapping both tabs quickly.

Actual Result:

From and date bottom modal able to be opened together by tapping both tabs quickly.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6849909_1748973155847.Screenrecorder-2025-06-03-23-18-24-4.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021930286650964375781
  • Upwork Job ID: 1930286650964375781
  • Last Price Increase: 2025-06-04
  • Automatic offers:
    • suneox | Reviewer | 107630557
    • nkdengineer | Contributor | 107630560
Issue OwnerCurrent Issue Owner: @lschurr

Activity

  1. added
    Daily
    Bug
    on Jun 4, 2025
  2. melvin-bot commented on Jun 4, 2025

    @melvin-bot

    Triggered auto assignment to @lschurr (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  3. nkdengineer commented on Jun 4, 2025

    @nkdengineer
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-06-04 04:29:41 UTC.

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    From and date bottom modal able to be opened together by tapping both tabs quickly.

    What is the root cause of that problem?

    We don't have the logic to prevent opening second popover when the first one is open

    What changes do you think we should make in order to solve the problem?

    Solution 1:

    In DropdownButton we can get willAlertModalBecomeVisible from modal to detect if there's open modal

    const [modal] = useOnyx(ONYXKEYS.MODAL, {canBeMissing: true});
    
    ...
    
    const toggleOverlay = () => {
            if (!isOverlayVisible && modal?.willAlertModalBecomeVisible) {
                return;
            }
    ...
    

    Solution 2:

    We should define the isPopoverOpen ref in SearchFiltersBar

    const isPopoverOpen = useRef(false);
    
        const setIsPopoverOpen = useCallback((value: boolean) => {
            isPopoverOpen.current = value;
        }, []);
        
        const shouldShowPopover = useCallback(() => {
            return !isPopoverOpen.current;
        }, []);
    

    Then use it in DropdownButton to prevent opening the second popover

    const toggleOverlay = () => {
            if (!isOverlayVisible && !shouldShowPopover()) {
                return;
            }
    
            setIsOverlayVisible((previousValue) => {
                ...
                setIsPopoverOpen(!previousValue);
                return !previousValue;
            });
        };
    

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    None

    What alternative solutions did you explore? (Optional)

    NA

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  4. dmkt9 commented on Jun 4, 2025

    @dmkt9
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    From and date bottom modal able to be opened together by tapping both tabs quickly.

    What is the root cause of that problem?

    Because the DropdownButton does not have a mechanism to close other popovers when opening a popover:

    const filterList = [
    {
    label: translate('common.type'),
    PopoverComponent: typeComponent,
    value: typeValue?.translation ? translate(typeValue.translation) : null,
    },
    {
    label: translate('common.status'),
    PopoverComponent: statusComponent,
    value: statusValue.map((option) => translate(option.translation)),
    },
    {
    label: translate('common.date'),
    PopoverComponent: datePickerComponent,
    value: dateValue,
    },
    {
    label: translate('common.from'),
    PopoverComponent: userPickerComponent,
    value: fromValue,
    },
    ];

    {filters.map((filter) => (
    <DropdownButton
    key={filter.label}
    label={filter.label}
    value={filter.value}
    PopoverComponent={filter.PopoverComponent}
    />
    ))}

    What changes do you think we should make in order to solve the problem?

    Add a mechanism to close all other popovers if they are open when opening a new one:

    1. Add an onToggleVisible prop for DropdownButton to pass the toggled state back to the parent:
      PopoverComponent: React.FC<PopoverComponentProps>;
    onToggleVisible?: (isVisible: boolean) => void;

    function DropdownButton({label, value, viewportOffsetTop, PopoverComponent}: DropdownButtonProps) {

    function DropdownButton({label, value, viewportOffsetTop, PopoverComponent, onToggleVisible}: DropdownButtonProps) {

    onToggleVisible?.(!previousValue);
    1. In the function that generates the filter list, add wrappers to obtain the closeOverlay handlers and handle closing other popovers when opening one:
      const filterList = [
      {
      label: translate('common.type'),
      PopoverComponent: typeComponent,
      value: typeValue?.translation ? translate(typeValue.translation) : null,
      },
      {
      label: translate('common.status'),
      PopoverComponent: statusComponent,
      value: statusValue.map((option) => translate(option.translation)),
      },
      {
      label: translate('common.date'),
      PopoverComponent: datePickerComponent,
      value: dateValue,
      },
      {
      label: translate('common.from'),
      PopoverComponent: userPickerComponent,
      value: fromValue,
      },
      ];
    const allVisibleStateAndCloseOverlay: Record<string, {isVisible: boolean; closeOverlay: () => void}> = {};
    const PopoverComponentWrapper = (id: string, component: ({closeOverlay}: PopoverComponentProps) => React.JSX.Element) => {
        return ({closeOverlay}: PopoverComponentProps) => {
            allVisibleStateAndCloseOverlay[id] = {...(allVisibleStateAndCloseOverlay[id] ?? {isVisible: false}), closeOverlay};
            return component({closeOverlay});
        };
    };
    
    const onToggleVisibleWrapper = (id: string) => {
        return (isVisible: boolean) => {
            if (isVisible) {
                Object.entries(allVisibleStateAndCloseOverlay).forEach(([idKey, {isVisible: visibleState, closeOverlay}]) => {
                    if (id === idKey || !visibleState) {
                        return;
                    }
                    
                    closeOverlay();
                });
            }
            allVisibleStateAndCloseOverlay[id].isVisible = isVisible;
        };
    };
    
    const filterList = [
        {
            label: translate('common.type'),
            PopoverComponent: PopoverComponentWrapper('common.type', typeComponent),
            value: typeValue?.translation ? translate(typeValue.translation) : null,
            onToggleVisible: onToggleVisibleWrapper('common.type'),
        },
        {
            label: translate('common.status'),
            PopoverComponent: PopoverComponentWrapper('common.status', statusComponent),
            value: statusValue.map((option) => translate(option.translation)),
            onToggleVisible: onToggleVisibleWrapper('common.status'),
        },
        {
            label: translate('common.date'),
            PopoverComponent: PopoverComponentWrapper('common.date', datePickerComponent),
            value: dateValue,
            onToggleVisible: onToggleVisibleWrapper('common.date'),
        },
        {
            label: translate('common.from'),
            PopoverComponent: PopoverComponentWrapper('common.from', userPickerComponent),
            value: fromValue,
            onToggleVisible: onToggleVisibleWrapper('common.from'),
        },
    ];
    1. Pass the onToggleVisible prop to DropdownButton:
      <DropdownButton
      key={filter.label}
      label={filter.label}
      value={filter.value}
      PopoverComponent={filter.PopoverComponent}
      />
    onToggleVisible={filter.onToggleVisible}

    👍 test branch

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    N/A

    What alternative solutions did you explore? (Optional)

    N/A

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  5. added
    External
    on Jun 4, 2025
  6. changed the title [-]reports-From and date bottom modal able to be opened together by tapping both tabs quickly.[/-] [+][$250] reports-From and date bottom modal able to be opened together by tapping both tabs quickly.[/+] on Jun 4, 2025
  7. melvin-bot commented on Jun 4, 2025

    @melvin-bot
  8. added
    Help Wanted
    on Jun 4, 2025
  9. melvin-bot commented on Jun 4, 2025

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @suneox (External)

  10. nkdengineer commented on Jun 9, 2025

    @nkdengineer
    Contributor

    @suneox What do you think about my proposal?

  11. suneox commented on Jun 9, 2025

    @suneox
    Contributor

    Thank you for all the proposals. I'll take a look at this one within today

  12. 20 remaining items

  13. dangrous commented on Jul 1, 2025

    @dangrous
    Contributor

    Just to confirm, this had a regression that was then fixed, right?

  14. melvin-bot commented on Jul 3, 2025

    @melvin-bot

    ⚠️ Looks like this issue was linked to a Deploy Blocker here

    If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

    If a regression has occurred and you are the assigned CM follow the instructions here.

    If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

  15. suneox commented on Jul 3, 2025

    @suneox
    Contributor

    Just to confirm, this had a regression that was then fixed, right?

    Yes, the previous regression issue was fixed. I'm not sure if we're seeing another regression here, as a new issue doesn't occur on the production

  16. dangrous commented on Jul 4, 2025

    @dangrous
    Contributor

    seems unrelated based on the discussion on that issue so I think we're good!

  17. added
    Daily
    and removed
    Weekly
    on Jul 4, 2025
  18. lschurr commented on Jul 4, 2025

    @lschurr
    Contributor

    Alright, cool! So this should be $125 payments right @dangrous @suneox?

  19. suneox commented on Jul 4, 2025

    @suneox
    Contributor

    Alright, cool! So this should be $125 payments right @dangrous @suneox?

    Yes, that's correct — it should be 50% of the original price since this is a regression fix.

  20. lschurr commented on Jul 7, 2025

    @lschurr
    Contributor

    Payment summary:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentBugDailyExternal

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions