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

Fix tooltip bug, truncate componentName to use ellipsis #78

Merged
merged 4 commits into from
Jul 27, 2020

Conversation

kartikcho
Copy link
Member

Resolves #47 and also closes #67

This PR fixes the canvas reset issue when the tooltips would overflow the CanvasPage (checkout issue for more context).

The solution to allow overflow on CanvasPage was something of a hunch that made sense and worked. The root cause I think was an edge case of the eventTooltip div overflowing the current div with no room left for the tooltip to reduce to. (Doesn't make much sense describing as text, I discussed this internally with @taneliang to explain better).

Removed empty class Duration.

This PR also truncates long component names with ellipsis.
(Not tested yet, ideally should work. Will mark it ready for review as soon as I can test it with suitable data)

@kartikcho kartikcho requested a review from taneliang July 20, 2020 12:28
@vercel
Copy link

vercel bot commented Jul 20, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/mlh-fellowship/scheduling-profiler-prototype/rhfe8zhkz
✅ Preview: https://scheduling-profiler-prototype-git-eventtooltip-fix.mlh-fellowship.vercel.app

@kartikcho
Copy link
Member Author

This is how strings longer than 32 characters look like now for componentName.
image

Set a limit to Script URL to 64 characters which helps with the layout but reduces information displayed in the URL.
Setting it to 128 char still persisted the issue.

image

@taneliang
Copy link
Member

Seems like there's still a bug:
image

For the script URL, could we do whatever's being done for component stacks, i.e. that fading and truncation?

image

The tooltips also go past the edge of the canvas are hidden. Would putting the overflow:hidden on body work better?

image

@kartikcho
Copy link
Member Author

It's really a weird bug, half of the script URLs wrap and the other half don't, even though the URL is exactly the same. Reducing it to 64 seemed to fix the issue but you still encountered it, I'll look again.

The tooltips also go past the edge of the canvas are hidden. Would putting the overflow:hidden on body work better?

They will go past the canvas regardless since they're not a part of the canvas but instead a div on top of the canvas.

@taneliang
Copy link
Member

I'm also concerned about truncating component names. Some of these components seem to be wrapped in a few higher order functions and it'll be impossible to identify the original component that was wrapped.

Although in this screenshot you can see it from the component stack, we may not be able to depend on the presence of component stacks (as Brian mentioned it's currently it's not enabled (facebook/react#19396), and facebook/react#19223 (comment) suggests that we may not even want to have component stacks).

I'm not sure how the tooltip width is set/derived, but will increasing the max width of the tooltips make sense and truncate only unreasonably long names?

image

@taneliang
Copy link
Member

They will go past the canvas regardless since they're not a part of the canvas but instead a div on top of the canvas.

Yeah. It's fine that they go past the canvas. What I was trying to achieve was to prevent the clipping of the areas of the tooltip that are outside the canvas' bounds.

@kartikcho
Copy link
Member Author

What do you think about this? I could set the trim to longer than 128 characters for component names.
image

This is the weird behavior I meant in my earlier comment, the URL length are the same

As it should be:
image

The bug:
image

Copy link
Member

@taneliang taneliang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work well 👍

@kartikcho kartikcho merged commit 515e2cf into master Jul 27, 2020
@kartikcho kartikcho deleted the eventTooltip-fix branch July 27, 2020 07:09
taneliang added a commit that referenced this pull request Aug 6, 2020
Tooltips would go offscreen because of the way `top` is defined. This
commit fixes that root cause by changing CanvasPage to position fixed so
that tooltips will be positioned relative to the DOM rather than the
CanvasPage div.

Undoes some of the changes made in #78 as this commit fixes the root
cause of the bug.
kartikcho pushed a commit that referenced this pull request Aug 10, 2020
* Minor clean up of EventTooltip.js

* Fix root cause of #47 and improve tooltip styling

Tooltips would go offscreen because of the way `top` is defined. This
commit fixes that root cause by changing CanvasPage to position fixed so
that tooltips will be positioned relative to the DOM rather than the
CanvasPage div.

Undoes some of the changes made in #78 as this commit fixes the root
cause of the bug.

* Disable component name truncation

Although this was Brian's recommendation (see #67), I don't think
component names will be very long because the source code for those will
be really annoying.

* Set mouse location on every interaction to fix #87

* Introduce 768-char component name length limit

Covers the unlikely edge case that a component name is unreasonably
long.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants