Closed kavimuru closed 1 year ago
Triggered auto assignment to @isabelastisser (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details.
Platforms
in OP are ✅)Hey @kavimuru, @hungvu193 did you copy the email? From your recording, I'm unsure if you did it, but it looks like it was the case. Please provide more context and I will continue to review this. Thanks!
@kavimuru @hungvu193 please follow up on my question above, thanks! I'm unable to reproduce it.
Job added to Upwork: https://www.upwork.com/jobs/~019546d7509b0c8a21
Current assignee @isabelastisser is eligible for the External assigner, not assigning anyone new.
Triggered auto assignment to Contributor-plus team member for initial proposal review - @Santhosh-Sellavel (External
)
Triggered auto assignment to @yuwenmemon (External
), see https://stackoverflow.com/c/expensify/questions/7972 for more details.
@isabelastisser Account should have several IOUs (better with optional messages in the IOU )and hovering on of the emails in the details page and scrolling
Hi, I just checked the description that posted at Upwork. and checked the video. It is related with package's delay time. To fix it, there are two methods.
📣 @goddev99! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
Contributor details Your Expensify account email: rodev097@gmail.com Upwork Profile Link: (https://www.upwork.com/freelancers/~019db16fae3db25fa9)
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Not overdue, waiting for proposals!
Tooltip doesn't disappear while page is scrolling
I think the root cause for this is even on scroll the hovered component view is unable to get the mouse leave event on it. So the tooltip stills appers.
We can attach a wheel
event listener to the tooltip component and call thehideTooltip
when there is onWheel event.
This will make the tooltip hidden.
componentDidMount() {
window.addEventListener('wheel', () => {
this.hideTooltip();
});
}
UI after applying the above code
None
@soumyajit4419 if you can't find others from the parameter list of package, I think the method is good to solve the issue.
Contributor details Your Expensify account email: altosh.mail@gmail.com Upwork Profile Link: https://www.upwork.com/freelancers/~01d508c9ea2305f211
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Tooltip doesn't disappear while page is scrolling
The Hoverable component's view is not receiving the mouse leave event on the scroll.
When the Hoverable component becomes "isHovered:true" we can start listening document wheel event. When we receive wheel event we can change the state to "isHovered:false" and call onHoverOut (and remove the wheel listener).
We can quickly test if the idea works (Hoverable):
componentDidMount
this.onWheel = () => {
if (!this.state.isHovered) {
return;
}
this.setState({isHovered: false}, this.props.onHoverOut);
};
document.addEventListener('wheel', this.onWheel);
componentWillUnmount
document.removeEventListener('wheel', this.onWheel);
It might lead to an issue if the pointer is still in the hoverable area after the scroll: onMouseEnter won't be triggered until onMouseLeave. I guess we can solve it by listening to the "mouse move" and changing the state according to the local mouse position and bounds (See the alternative solutions section).
This is a quick code to see if the idea works: Hoverable component
<View onWheel=...
onWheel(event) {
const bounds = event.currentTarget.getBoundingClientRect();
const localY = event.clientY - bounds.top;
let hovered = this.isHovered;
if (localY < 0 || localY > bounds.height) {
hovered = false;
} else {
hovered = true;
}
if (this.isHovered !== hovered) {
this.setIsHovered(hovered);
}
}
And the result is:
Update: As I see this solution does not work for all situations, so I think for now the best solution would be "According to the bounds".
According to the further investigation: While the above solutions solve the issue but it is still not the best solution, as I believe they don't solve the main issue. The issue exists everywhere where used Hoverable in a scrollable list. For instance:
. As I mentioned as a root cause: The Hoverable component's view is not receiving onMouseLeave and onMouseEnter events on scrolling. But I realized that if the FlatList is inverted (<FlatList inverted...) then it starts to receive these events on the scroll. I searched for the cause in the React Native source code but could not find it. But it seems we can use this workaround because, in my opinion, it gives the best result. The basic idea is to use the inverted FlatList with the reversed data list.
And the result is:
I extended the previous solution: A new mechanism that accepts Hoverable elements and provides 'mouse enter' and 'mouse leave' events for that elements.
On the document 'wheel' event, it gets the position and size of every element (Hoverable elements) and detects if the mouse pointer is inside or outside of the element, and emits the 'enter' or 'leave' event.
As in the video capture below, it solves the issue at all places (tooltip, highlighting...)
If needed I can share the code (I wrote it just for validation so it is low quality and about 50 lines) I used getBoundingClientRect just for validation, I guess its better to use IntersectionObserver to prevent the reflow
Unassigning As I will not be get to this sooner, please reassign other C+ by applying external
label again @yuwenmemon or @isabelastisser
I am happy to take this since I am already run out of issues for a few weeks.
@isabelastisser or @yuwenmemon Please assign @0xmiroslav so they can take over as C+
📣 @0xmiroslav You have been assigned to this job by @yuwenmemon! Please apply to this job in Upwork and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑💻 Keep in mind: Code of Conduct | Contributing 📖
Thanks for assigning me. Help Wanted
label can be added back.
@0xmiroslav There are proposals above please review them
@goddev99 @usenbekov Please read through contributing guideline to be familiar with our process.
@soumyajit4419 thanks for your proposal but your root cause analysis isn't correct.
@soumyajit4419 thanks for your proposal but your root cause analysis isn't correct.
@0xmiroslav I think the root cause for this is even on scroll the tooltip listeners or tooltip component is unable to know that the pointer is still on the element or not So it keeps on showing
@soumyajit4419 your root cause is still not accurate. Also please follow updated proposal template like this, instead of adding segmented comments.
I guess we can solve it by listening to the "mouse move" and changing the state according to the local mouse position and bounds (this will solve the issue but needs some investigation to find a better implementation).
@usenbekov do you have solution in detail?
@soumyajit4419 I don't quite understand your solution.
Then In tooltip we can pass empty text based on isScrollling prop
<Tooltip text={props.isScrolling ? '' : actorEmail}>
isScrolling
should come from parent component. Which component are you referring to?
I guess we can solve it by listening to the "mouse move" and changing the state according to the local mouse position and bounds (this will solve the issue but needs some investigation to find a better implementation).
@usenbekov do you have solution in detail?
Updated
@soumyajit4419 I don't quite understand your solution.
Then In tooltip we can pass empty text based on isScrollling prop
<Tooltip text={props.isScrolling ? '' : actorEmail}>
isScrolling
should come from parent component. Which component are you referring to?
Here the parent component means IOUTransactionsModal
But I think this solution will be somewhat specific to this modal only
To make it work for all the cases or generic we can add listeners to the tooltip component only which I had proposed in my alternate solution.
componentDidMount() {
window.addEventListener('wheel', () => {
this.hideTooltip();
});
}
@soumyajit4419 We're looking for generic solution which applies to all scroll views across the app
@soumyajit4419 it's not a good idea to hide tooltip on any wheel event. This is current version:
So if mouse pointer is still within area which should show tooltip, it doesn't disappear on wheel. However, another issue in your solution is that after scroll and back to original position, hidden tooltip doesn't show back again.
@usenbekov I reviewed your alternative solutions to fix this concern but your bounding approach is still not ideal. This can be considered as last option if no better solutions exist. Btw, can I check your branch for testing?
But I realized that if the FlatList is inverted (<FlatList inverted...) then it starts to receive these events on the scroll. I searched for the cause in the React Native source code but could not find it. But it seems we can use this workaround because, in my opinion, it gives the best result. The basic idea is to use the inverted FlatList with the reversed data list.
This is not recommended at all. This still doesn't work on Safari.
@isabelastisser can we add Help Wanted
label to get more proposals?
@yuwenmemon @isabelastisser @0xmiroslav 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!
Tooltip is not dismissed on scroll
When we scroll up and down fast we're not giving the time to hover the next element, there is currently no function to dismiss a visible tooltip on scroll rather than dismissing on mouse leave.
To hide the tooltip when the user scrolls, we can attach an event listener to the document object using the addEventListener method. This listener will call the hideTooltip
function, which will take care of hiding the tooltip. By passing true
as the third argument to addEventListener
, we ensure that the event bubbles up to all scrollable containers on the page, this will insure the solution works on all scrollable containers.
document.addEventListener("scroll", this.hideOnScroll, true);
I handled both performance and edge cases to make sure everything works smoothly and as expected resulting the hideTooltip being called only if the tooltip is shown and scrolled making sure the performance is not impacted. Here is the branch for testing purpose - https://github.com/Expensify/App/compare/main...getusha:App:hide-tooltip-onscroll
Like Slack
and Discord
set hover state of Hoverable
false when the user scrolls
not overdue.
This is a ~dupe~ similiar to https://github.com/Expensify/App/issues/14127
It was decided to do nothing because the issue linked was specific only to safari, and this is a different issue which is happening on all Browsers and Desktop.
So the only reason https://github.com/Expensify/App/issues/14127 closed was the issue happened only on Safari
Thank you @getusha.
I think for performance reasons browsers do not fire the mouseleave event on scroll. This is behaviour can be seen across the app except on the report actions list. The mouseleave will still fire. I think this has to do with some css styles (perhaps transform styles) that forces the browser to fire the event. This looks related to the styles that we apply after we make the flatlist an inverted flatlist.
InvertedFlatList | FlatList |
---|---|
What I'm trying to say here is maybe we should investigate the styles that forces the browser to fire the mouseleave event on scroll and apply them on places that are critical to have such behaviour.
@usenbekov I reviewed your alternative solutions to fix this concern but your bounding approach is still not ideal. This can be considered as last option if no better solutions exist. Btw, can I check your branch for testing?
Sure, sharing the Hoverable class (I wrote it just to validate the idea): https://gist.github.com/usenbekov/b6f9e2dbd349715df20f27a661af4a7d
The result can be seen here (last video): https://github.com/Expensify/App/issues/15757#issuecomment-1470922193
@s77rt we still want to hide the tooltip even on InvertedFlatList
on scroll
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Action Performed:
Expected Result:
Tooltip should disappear while page is scrolling.
Actual Result:
Tooltip doesn't disappear while page is scrolling.
Workaround:
unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.2.80-1 Reproducible in staging?: y Reproducible in production?: y 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 Notes/Photos/Videos:
https://user-images.githubusercontent.com/43996225/223875450-fc035282-c95f-43fd-93fa-48033fc6c352.mp4
https://user-images.githubusercontent.com/43996225/223875464-e402dcf5-59f0-4d30-8150-066cc9c97df8.mov
Expensify/Expensify Issue URL: Issue reported by: @hungvu193 Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1678296752620849
View all open jobs on GitHub
Upwork Automation - Do Not Edit