-
Notifications
You must be signed in to change notification settings - Fork 3k
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] Submit expenses and chat with approver tooltip appears at the top of the page sometimes #54924
Comments
Triggered auto assignment to @bfitzexpensify ( |
This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989 |
I'm able to reproduce this issue with either new accounts
or set
Screen.Recording.2025-01-08.at.17.42.22.mov |
Please assign me as a C+ for this issue. Thank you. |
🚨 Edited by proposal-police: This proposal was edited at 2025-01-17 14:57:08 UTC. ProposalPlease re-state the problem that we are trying to solve in this issue.Submit expenses and chat with approver tooltip appears at the top of the page sometimes What is the root cause of that problem?there's no mechanism set to handle scrolling events What changes do you think we should make in order to solve the problem?a more straight forward appraoch, is chekking if element is within view port, this is flexible way to deal with all pages
the above is for web only to include native, it could be something similar to this :
could be polished in PR phase bandicam.2025-01-17.14-48-36-976.mp4What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?UI issue What alternative solutions did you explore? (Optional) |
@hoangzinh feel free to take over, just coming here from here to say that similar thing happen to filter button tooltip when we scroll the expenses on small screens, Make sure we fix it and other tooltips where this potentially happens |
also the expected behaviour is not show tooltip it if element it is pointing to is not in the visible view and ideally we keep the tooltip on it while scrolling pointing to element. Or if that's too hard, have it disappear while scrolling and re-appear once they stop (if the chat is still visible) - https://expensify.slack.com/archives/C07NMDKEFMH/p1736277111466739?thread_ts=1736274954.289009&cid=C07NMDKEFMH |
Done! |
@ishpaul777 @hoangzinh , I guess it's supposed to be educational meaning it leads the user through the app ... I think: bandicam.2025-01-09.16-56-43-609.mp4 |
@M00rish i am sorry but i dont follow what you mean by this tooltip is only shown to active (default) workspace chat of user, what do you propose? |
🚨 Edited by proposal-police: This proposal was edited at 2025-01-12 12:42:58 UTC. 🚨 Edited by proposal-police: This proposal was edited at 2025-01-12 12:42:58 UTC. Edited by proposal-police: This proposal was edited at 2025-01-12 12:42:58 UTC. ProposalPlease re-state the problem that we are trying to solve in this issue.Submit expenses and chat with approver tooltip appears at the top of the page sometimes What is the root cause of that problem?We are not updating the position of the tooltip when the layout of the content changes(Because the
What changes do you think we should make in order to solve the problem?To address this issue, we can use const elementRef = useRef();
const [isVisibleElement, setIsVisibleElement] = useState(false);
const getBounds = (bounds: DOMRect): LayoutRectangle => {
const targetElement = elementRef.current?._childNode;
const elementAtPoint = document.elementFromPoint(bounds.x, bounds.y + bounds.height / 2); //Consider increase x by + padding
if (elementAtPoint && 'contains' in elementAtPoint && targetElement && 'contains' in targetElement) {
if (shouldCheckBottomVisible) {// This flag is true in LHN
const viewportHeight = window.innerHeight; // The height of the visible viewport
const isBottomVisible = bounds.bottom + bounds.height <= viewportHeight; //Consider decrease viewportHeight by - padding
const isInViewport = isBottomVisible;
if (!isInViewport) {
setIsVisibleElement(false);
return bounds
}
}
const isElementVisible =
elementAtPoint instanceof HTMLElement &&
(targetElement?.contains(elementAtPoint) || elementAtPoint?.contains(targetElement)); // We can update condition here, if we need other expected
setIsVisibleElement(isElementVisible)
}
return bounds;
};
...
<BoundsObserver
enabled={shouldRender}
onBoundsChange={(bounds) => {
updateTargetBounds(getBounds(bounds));
}}
ref={elementRef}
>
{React.cloneElement(children as React.ReactElement, {
onLayout: (e: LayoutChangeEventWithTarget) => {
if (!shouldMeasure) {
setShouldMeasure(true);
}
// e.target is specific to native, use e.nativeEvent.target on web instead
const target = e.target || e.nativeEvent.target;
show.current = () => measureTooltipCoordinate(target, updateTargetBounds, showTooltip);
},
})}
</BoundsObserver> We need
shouldRender={shouldRender && isVisibleElement} For the detailed code, we can discuss it later in PR. POC
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?No, UI bug What alternative solutions did you explore? (Optional)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. |
@hoangzinh, @bfitzexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick! |
Job added to Upwork: https://www.upwork.com/jobs/~021878933333602082321 |
Current assignee @hoangzinh is eligible for the External assigner, not assigning anyone new. |
@hoangzinh @mohit6789 Does the selected proposal fix #54925 by any chance? |
@ishpaul777 looks like related issue, but I will test and let you know. |
@hoangzinh @MonilBhavsar @bfitzexpensify this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks! |
Assigning @mohit6789 as their proposals fixes this issue. It would be great if it fixes other related issue |
📣 @mohit6789 You have been assigned to this job! |
I will create PR before end of this week. |
@hoangzinh @MonilBhavsar Current solution by using Currently we have two places where BaseEducationalTooltip is used during scrolling 1) SearchTypeMenuNarrow 2) OptionRowLHN. So to fix tooltip issue during scrolling, below is my suggested solution. Please let me know your thoughts or if you have any other better solution than this.
Same applied for SearchTypeMenuNarrow component. Also to performance I believe we should hide the tooltip during scrolling and show it once scrolling completed. Because Scrolling event fire very fast and it will made lots of calculation. So it is better to hide the tooltip during scrolling and show when scrolling completes. Note: Currently we are using |
@hoangzinh @MonilBhavsar any thoughts on above comment? |
hi @mohit6789 sorry for the late response. I wasn't aware that BoundsObserver doesn't work on native too. The thing I don't like above solution is we have to capture position in the parent component, then pass it onto |
@hoangzinh Okay I will make demo and send to you tomorrow. |
@hoangzinh do you have any other option apart from passing the data from the Parent component. I tried to find out but could not get success. |
I am working on creating demo but still I am facing some issues. I will create demo soon. |
Thanks for the update @mohit6789. I tried some options but none of them work for me. |
just a suggestion if that helps i see we have event emitter for scrolling, can we catch that and hide/reposition the tooltip using this App/src/components/InvertedFlatList/index.tsx Lines 33 to 48 in 4ec40e4
|
Thank you @ishpaul777. Sounds like a great suggestion. What do you think? @mohit6789 |
Indeed, it is great suggestion. Let me check this and I will get back to you. Thank you! @ishpaul777 @hoangzinh |
@hoangzinh here is the screen recording of the solution @ishpaul777 suggested. And this is #56209 draft PR. IOS.Tooltip.mov |
@MonilBhavsar @bfitzexpensify what do you think about the recording above ^? Because of performance, we need to hide the tooltip during scrolling and show it once scrolling is completed. |
@bfitzexpensify @MonilBhavsar any thoughts? |
@hoangzinh @mohit6789 @MonilBhavsar @bfitzexpensify this issue is now 4 weeks old, please consider:
Thanks! |
Not overdue, awaiting @bfitzexpensify @MonilBhavsar share thoughts on #54924 (comment) |
@MonilBhavsar @bfitzexpensify can you please look into above comments and provide your thoughts? |
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: v9.0.81-6
Reproducible in staging?: yes
Reproducible in production?: yes
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?:
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @flaviadefaria
Slack conversation (hyperlinked to channel name): migrate
Action Performed:
Expected Result:
Should appear with in the report active window
Actual Result:
sometimes displays at the top of the page. Also when I scroll down the chats on the LHP it stays static rather than following the workspace that it is pointing to.
Workaround:
unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
2025-01-06_21-26-00.1.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @Issue Owner
Current Issue Owner: @hoangzinhThe text was updated successfully, but these errors were encountered: