Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[$250] Web - Reports - Filters button tooltip is not displayed properly #54596

Open
2 of 8 tasks
mitarachim opened this issue Dec 27, 2024 · 12 comments
Open
2 of 8 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@mitarachim
Copy link

mitarachim commented Dec 27, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 9.0.79-0
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A
If this was caught during regression testing, add the test name, ID and link from TestRail: Exp
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause Internal Team
Device used: Mac 15.0 / Chrome
App Component: Search

Action Performed:

  1. Go to staging.new.expensify.com
  2. Log in with a new account.
  3. Click on the search icon on the top right (do not go to Reports).
  4. Enter anything and search.

Expected Result:

Tooltip will be properly displayed under Filters button.

Actual Result:

Tooltip is incorrectly displayed.
The arrow is under Filters button, but the content (the box) is far away from the arrow.

Workaround:

Unknown

Platforms:

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6702688_1735252108448!Screenshot_2024-12-27_at_05 24 31
Bug6702688_1735252108451.2tip.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021872571944019699277
  • Upwork Job ID: 1872571944019699277
  • Last Price Increase: 2024-12-27
Issue OwnerCurrent Issue Owner: @thesahindia
@mitarachim mitarachim added DeployBlockerCash This issue or pull request should block deployment Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. DeployBlocker Indicates it should block deploying the API labels Dec 27, 2024
Copy link

melvin-bot bot commented Dec 27, 2024

Triggered auto assignment to @techievivek (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

Copy link

melvin-bot bot commented Dec 27, 2024

Triggered auto assignment to @bfitzexpensify (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.

Copy link

melvin-bot bot commented Dec 27, 2024

💬 A slack conversation has been started in #expensify-open-source

@github-actions github-actions bot added Engineering Hourly KSv2 and removed Daily KSv2 labels Dec 27, 2024
Copy link
Contributor

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

@mitarachim
Copy link
Author

not reproducible when disable Use Staging Server

bandicam.2024-12-27.06-35-39-785.mp4

@mitarachim mitarachim changed the title Reports - Filters button tooltip is not displayed properly Web - Reports - Filters button tooltip is not displayed properly Dec 27, 2024
@linhvovan29546
Copy link
Contributor

linhvovan29546 commented Dec 27, 2024

Edited by proposal-police: This proposal was edited at 2024-12-27 09:30:08 UTC.

Proposal

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

Web - Reports - Filters button tooltip is not displayed properly

What is the root cause of that problem?

The tooltip displayed here

<EducationalTooltip
shouldRender={shouldShowProductTrainingTooltip}
anchorAlignment={{
vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.BOTTOM,
horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.RIGHT,
}}
shouldUseOverlay
shiftHorizontal={variables.searchFiltersTooltipShiftHorizontal}
wrapperStyle={styles.productTrainingTooltipWrapper}
renderTooltipContent={renderProductTrainingTooltip}
onHideTooltip={hideProductTrainingTooltip}

And on the web and desktop we renter tooltip with shiftHorizontal=variables.searchFiltersTooltipShiftHorizontalNarrow(-20) which causes the tooltip's position to be incorrect.

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

To resolve this issue, we can:

  • Update shiftHorizontal to 0.
  • Set anchorAlignment.horizontal to CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.CENTER, similar to how it is handled in SearchTypeMenuNarrow.
    NOTE: In the SearchPageHeader component, In the SearchPageHeader component, since the children inside SearchPageHeaderInput are rendered conditionally based on isCannedQuery, we also need to ensure that isCannedQuery is checked appropriately
 <EducationalTooltip
                        shouldRender={shouldShowProductTrainingTooltip}
                        anchorAlignment={{
                            vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.BOTTOM,
                            horizontal: isWebOrDesktop && !isCannedQuery ? CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.CENTER : CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.RIGHT,
                        }}
                        shouldUseOverlay
                        shiftHorizontal={isWebOrDesktop && !isCannedQuery ? 0 : variables.searchFiltersTooltipShiftHorizontal}
                        wrapperStyle={styles.productTrainingTooltipWrapper}
                        renderTooltipContent={renderProductTrainingTooltip}
                        onHideTooltip={hideProductTrainingTooltip}
                    >
POC

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

@techievivek
Copy link
Contributor

Not a blocker, sending it to external.

@techievivek techievivek added External Added to denote the issue can be worked on by a contributor Daily KSv2 and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 DeployBlocker Indicates it should block deploying the API labels Dec 27, 2024
@melvin-bot melvin-bot bot changed the title Web - Reports - Filters button tooltip is not displayed properly [$250] Web - Reports - Filters button tooltip is not displayed properly Dec 27, 2024
Copy link

melvin-bot bot commented Dec 27, 2024

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Dec 27, 2024
Copy link

melvin-bot bot commented Dec 27, 2024

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

@linhvovan29546
Copy link
Contributor

Updated proposal #54596 (comment)
We need to ensure that isCannedQuery is checked as well.

This comment was marked as off-topic.

@daledah
Copy link
Contributor

daledah commented Dec 27, 2024

Proposal

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

Tooltip is incorrectly displayed.
The arrow is under Filters button, but the content (the box) is far away from the arrow.

What is the root cause of that problem?

We're calculating the horizontalShift here:

horizontalShift = computeHorizontalShift(windowWidth, xOffset, tooltipTargetWidth, tooltipWidth, manualShiftHorizontal);

and we're assuming the tooltip position is at the center of target

const tooltipRightEdge = componentCenter tooltipWidth / 2;

but the tooltip position can be right, left, and center

so the tooltipLeftEdge and tooltipRightEdge are incorrect

that trigger the logic here (even though the tooltip right edge can't be over the window right edge since it's the RIGHT here
)

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

  1. Calculate rootWrapperLeft and pointerWrapperLeft based on xOffset, manualShiftHorizontal and anchorAlignment

  2. Calculate the horizontalShift after getting rootWrapperLeft here so if the tooltip is hidden by window edge, the horizontalShift will be used to adjust

const computeHorizontalShift: ComputeHorizontalShift = (windowWidth, tooltipLeftEdge, tooltipWidth) => {
    const tooltipRightEdge = tooltipLeftEdge   tooltipWidth

    if (tooltipLeftEdge < GUTTER_WIDTH) {
        // Tooltip is in left gutter, shift right by a multiple of four.
        return roundToNearestMultipleOfFour(GUTTER_WIDTH - tooltipLeftEdge);
    }

    if (tooltipRightEdge > windowWidth - GUTTER_WIDTH) {
        // Tooltip is in right gutter, shift left by a multiple of four.
        return roundToNearestMultipleOfFour((windowWidth - GUTTER_WIDTH - tooltipRightEdge));
    }

    // Tooltip is not in the gutter, so no need to shift it horizontally
    return 0;
};
  1. Then update rootWrapperLeft and pointerWrapperLeft with horizontalShift
rootWrapperLeft = xOffset   manualShiftHorizontal;
            switch (anchorAlignment.horizontal) {
                case CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.LEFT:
                    pointerWrapperLeft = POINTER_WIDTH / 2;
                    break;
                case CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.RIGHT:
                    pointerWrapperLeft = (tooltipWidth - POINTER_WIDTH * 1.5);
                    rootWrapperLeft  = tooltipTargetWidth - tooltipWidth;
                    break;
                case CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.CENTER:
                default:
                    pointerWrapperLeft = (tooltipWidth / 2 - POINTER_WIDTH / 2);
                    rootWrapperLeft  = tooltipTargetWidth / 2 - tooltipWidth / 2;
            }

            horizontalShift = computeHorizontalShift(windowWidth, rootWrapperLeft, tooltipWidth);

            // Determine if we need to shift the pointer horizontally to prevent it from being too near to the edge of the tooltip
            // We shift it to the right a bit if the tooltip is positioned on the extreme left
            // and shift it to left a bit if the tooltip is positioned on the extreme right.
            horizontalShiftPointer =
                horizontalShift > 0
                    ? Math.max(-horizontalShift, -(tooltipWidth / 2)   POINTER_WIDTH / 2   variables.componentBorderRadiusSmall)
                    : Math.min(-horizontalShift, tooltipWidth / 2 - POINTER_WIDTH / 2 - variables.componentBorderRadiusSmall);
            
            rootWrapperLeft  = horizontalShift;
            pointerWrapperLeft  = horizontalShiftPointer;

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

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.

Result

Screenshot 2024-12-27 at 17 38 05

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
None yet
Development

No branches or pull requests

6 participants