-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Expensify chat - web/desktop, when hovering over a user's name anywhere, show their primary login details #1490
Comments
Proposal
b) Next, we need to update the tooltip component to take style props so that we can give
Part 2we modify the function here and add another property into the options object with the value of the report name without the |
I'm not sure I follow why this is necessary. The tooltip should be centered on its children, so if the child is a text element it should be centered on the text.
Again, could you explain this problem in a bit more detail?
Why not just give the tooltip a default style of
I've experienced the z-index problem you've describe before (and come up with a different solution), but I'm generally unclear on what you're proposing here. |
Generally it looks like you've thought out your proposal pretty thoroughly, but you maybe just need to do a better job explaining the base solution. Then for each additional change, make it more clear the problem you're trying to solve, and we can then discuss the best solution. |
@roryabraham . My bad explaining it.
https://github.com/Expensify/Expensify.cash/blob/380a148fdd47ce4c37e07ce647e1d9d31af8eb88/src/components/Header.js#L18-L24
it adds two wrapper divs, for the text to clip we need to set max-width on the parent wrapper. Max-width should be given to the immediate child of the flex container, it would be the wrapper by Hoverable component. I don't think it's a good idea to give the Hoverable component any styling as it can be used in other places as well. Check the Inspected HTML around the Text(Tooltip is added here) And I think we can remove the Hoverable component's View in the following way.
I meant that we need to attach the node of the tooltip to the body element in the DOM otherwise it will be hidden from other elements on the page so we use a prop container(standard name among frameworks) that decides whether we need to attach the Tooltip inline or to the Body of Page. |
Okay, thanks for the explanation, proposal looks good. Just a couple things:
For what its worth, this was the original implementation I used for the return React.children.map(children, child => {
const childWithHoverState = _.isFunction(child)
? child(this.state.isHovered)
: child;
return React.cloneElement(childWithHoverState, {
onMouseEnter: this.toggleHoverState,
onMouseLeave: this.toggleHoverState,
});
}); Not certain that's 100% correct, but you get the idea hopefully.
I'm a bit conflicted about this because, while it will work on web, I don't think it will work on native platforms. We want to keep this app 99.9999% cross-platform where possible. So I'd prefer if you just try to work around this by giving a higher z-index to the parent elements that contain a tooltip that's covered up by neighboring elements, rather than trying to attach the tooltip to the root. If that really can't work for some reason, then I think I'd prefer to see this approach:
|
I don't think that will there be a case where we need to add two direct children to the Hoverable. Then it would mean that hovering over two at a time, Not Good in Tree-based Dom(Hover state should link to only one node in DOM context https://html.spec.whatwg.org/multipage/semantics-other.html#selector-hover). There will always be a parent who gets hover if we need both children to have the hover effect. Or, Add hoverable to both children separately. CC: @marcaaron
I agree. There will be two implementations one for native (Empty wrapper)and one for the web. |
Sorry just catching up but I'm still stuck on this statement and wondering if we are overthinking the problem to compensate for this assumption here...
It makes sense to not give it a style by default, but if you need to set some styles on the |
Yeah. @marcaaron. We just need to set some styling for the text to clip in most of the cases. |
@marcaaron is @parasharrajat good to go here? |
@marcaaron @roryabraham bump when you get a moment today thanks |
LGTM. We can hash the rest out in reviews in any case. |
hi @parasharrajat is there a PR for this one yet? |
Soon, I will add one. @laurenreidexpensify |
👋
|
@trjExpensify Thanks. But let me be clear so that we are on the same page. primaryLogin => Email and not the Report Title. So
Is the above behavior Correct? |
Yup, it is. |
Awesome, thanks! |
@marcaaron (
<Text style={[styles.optionDisplayName, style]} numberOfLines={1} ref={this.ref}>
{_.map(option.participantsList, (participant, index) => (
<Fragment key={index}>
<Tooltip key={index} text={participant.login} containerStyle={styles.dInline}>
<Text>
{participant.displayName}
</Text>
</Tooltip>
{index < option.participantsList.length - 1 ? <Text>{', '}</Text> : null}
</Fragment>
))}
</Text>
); Second: <Tooltip text={activeParticipant}>
<Text style={[styles.optionDisplayName, style]} numberOfLines={1}>
{_.map(option.participantsList, (participant, index) => (
<>
<Hoverable
onHoverIn={() => this.selectParticipant(index)}
containerStyle={styles.dInline}
>
<Text>
{participant.displayName}
</Text>
</Hoverable>
{index < option.participantsList.length - 1 ? <Text>{', '}</Text> : null}
</>
))}
</Text>
</Tooltip>
The first one shows a separate tooltip for each name but we have to put {
isEllipsisActive
? (
// visually hidden but it is slightly right from the original ellipsis location
<View style={styles.optionDisplayNameTooltipEllipsis}>
<Tooltip text={option.tooltipText}>
<Text>...</Text>
</Tooltip>
</View>
) : null
} Now, I need some help to determine if I am on the right path or not. |
So just so I understand the effect of each of these approaches:
Is that correct?
Have you dug into why this is true? Would it be possible to create a |
Thanks for the article, I am going dig more on it. |
Hi @parasharrajat any luck yet? Can you post a little update of where you're at with the research? Thanks |
Yeah. @laurenreidexpensify I am going to make a screencast of all the approaches. I think we have to pick one which best suited or We have to make changes to the Tooltip. |
@parasharrajat Did |
@roryabraham so putting min-width:0; is fine. But the issue is that if there are multiple items, ellipsis show on multiple names, I guess due to the flex container try to shoe all the children and every child is shrinkable. Another shrinking behavior was that it shrinks the complete item. and just show ... instead for a particular child even if there is space left. So we just need to find a way to shrink the least children from the last. We need to put flex-shrink only on the last children that should be shrunk. I am recording this So we have a clear picture.With Flex Items and setting the Tooltip containers as
With Inline Items and setting the Tooltip containers as display Inline. screen-.2.mp4As you clearly see that we get the desired text wrapping with display inline but the tooltip position is still calculated based on the full width of the content wrapper. On the other hand, Flex items does has text wrapping but multiple items are shrunk at a time to keep all the items visible(default behaviour by browsers) check the note. Any input would help. What I think at the moment?Can we use a Grid layout? I think it's possible with grid layout. check here |
@roryabraham Any input for the comment above.
// Any additional amount to manually adjust the horizontal position of the tooltip.
// A positive value shifts the tooltip to the right, and a negative value shifts it to the left.
shiftHorizontal: PropTypes.number,
// Any additional amount to manually adjust the vertical position of the tooltip.
// A positive value shifts the tooltip down, and a negative value shifts it up.
shiftVertical: PropTypes.number, But I need to know how to calculate these exactly. |
Sorry for just getting back to this @parasharrajat, but looking at the video in the last comment, it looks like the tooltip is centered on the word, and the text-shrinking is happening as expected? What is the problem with this approach? |
@roryabraham In the video, you see that the tooltip should be rendered over the shrunk title (over the Sidebar) but it is being rendered on the center of the whole text underneath (which goes beyond the sidebar). But I have managed to show it at the correct location using the horizontalShift. Just preparing the PR for review. |
Okay sounds good, please feel free to add me as a reviewer 👍 |
@parasharrajat is there a PR yet for this one? Thanks |
@laurenreidexpensify Yeah, I made one couple days back which is under review. #1632 |
Awesome! Thanks!! |
We've had a minor issue with the solution here, in that tooltips are appearing on mobile web. |
Sure. I will pick this one. Let me think about the solution and get back to you, here. |
@parasharrajat One potential solution is to:
setIsHovered(isHovered) {
if (isHovered !== this.state.isHovered && !(isHovered && this.hoverDisabled)) {
this.setState({isHovered}, isHovered ? this.props.onHoverIn : this.props.onHoverOut);
}
}
|
Another potential solution (less fleshed out) would be to:
This solution comes with the added bonus that the animation delay (in my opinion) would improve the UX of tooltips, because right now they feel a bit over-zealous. |
We could also do both 😃 |
Do you want the tooltips to be shown on the mobile web? If no, then I would say just disable the Tooltips for Mobile Web. |
I think I prefer the first solution I outlined, because it allows us to have tooltips on hybrid devices (which are increasingly common). |
Agree. And while we are going back in can we also please tone down the scaling effect here? I think a simple fade would look a lot cleaner, but curious to get @shawnborton's thoughts. |
@roryabraham Unfortunately. First Solution is not working as expected.Read here why #1 - Clicking and Tapping - the "Natural" Order of Things. Touchend fires before mouseEnter thus it resets the state we want. But I have adjusted it. |
That works for me. Something nice and clean. |
Okay, @shawnborton @marcaaron. I will refer this to a new PR shortly. |
I personally think that just the delay will be enough to alleviate the "busyness" that the tooltips have right now. I kind of like the scaling effect. |
Reopening since @parasharrajat has another PR coming for the tooltip delay |
Okay - because of the regression with tooltips are appearing on mobile web, payment will now be 7 days from yesterday's deploy - so 31 March. |
If you haven’t already, check out our contributing guidelines for onboarding!
Deliverable:
On web/desktop, when hovering over a user's name anywhere, show their primary login. This includes:
Couple of other notes:
When the full list of names is hidden behind the ... ellipsis for Group DMs in the LHN/search results, I'd suggest we show a grouped list of all the participants' primaryLogins on hover of the ellipsis
for users that have phone numbers as primaryLogins, let's drop the @expensify.sms portion, so it's displayed on hover as: +447814266906 and not +447814266906@expensify.sms
https://www.upwork.com/jobs/~0146d36b55605d9064
The text was updated successfully, but these errors were encountered: