-
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
Remove multiple sources of tooltip size #19097
Conversation
Additional video to test other cases: Screen.Recording.2023-05-17.at.11.55.41.mov |
Here is the explanation of the issue: The root cause of the issue is a wrong calculation of horizontal shift. Currently, we have 2 different state to store tooltip size, tooltipWidth/tooltipHeight (the initial wrapper width) and tooltipContentWidth (the text width). ![]() Then, in App/src/styles/getTooltipStyles.js Lines 136 to 139 in 811c0f3
Let say tooltipWidth is at its maximum, which is 375, and tooltipContentWidth is 350. This means, the tooltipWrapperStyle width will be smaller (and different) than tooltipWidth, which also means the value is not synchronized between the tooltipWidth state and the actual tooltip width. And because tooltipWidth is being used to calculate the horizontal shift, we get the wrong result. Previously, we don't have this issue because we use onLayout that will "synchronize" the value. As we ultimately want to set the tooltip width based on it's content, we can just keep the state of the content width and height, then later on we calculate the tooltip wrapper size in |
Oops, I think @mananjadhav and @amyevans should be the one to review this. |
Bump @mananjadhav and un-assigning myself. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks for those few changes.
@bernhardoj There are conflicts now, please resolve when you get a chance 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changes look good, can we please resolve the conflicts @bernhardoj? I can start testing then.
Conflicts solved |
|
||
// Hide the tooltip entirely if it's size hasn't finished measuring yet. This prevents UI jank where the tooltip flashes close to its expected position. | ||
const opacity = isTooltipSizeReady ? 1 : 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because now we depends on isTooltipsizeReady
to set the opacity (previously xOffset and yOffset), we can safely remove it because the tooltip won't be shown if useLayoutEffect
hasn't done yet..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, getting to this in next few mins.
@bernhardoj Let's also link the original issue in |
Added 👍. |
Reviewer Checklist
Screenshots/VideosMobile Web - ChromeNA Mobile Web - SafariNA iOSNA AndroidNA Thanks @bernhardoj for fixing this and patience here. @amyevans @tgolen All yours. |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
@amyevans @mananjadhav I'm terribly sorry 🙇, but we have another regression only in Safari reported here where the text is truncated. I found the problem is the width from Width from Emoji picker tooltip ![]() We previously use Even I'm thinking 2 options:
We don't need to change the height calculation. We just need to have extra width for Safari not truncating the text Let me know if you agree and which one is preferable (I prefer the 2nd one to be very safe with Safari) and I will open another PR (we will test at least on Safari, Chrome, Firefox). |
🚀 Deployed to staging by https://github.com/amyevans in version: 1.3.17-0 🚀
|
@mananjadhav @amyevans Bump on this one #19097 (comment) before it becomes a deploy blocker. |
Thanks @bernhardoj for raising the PR. I tested the first PR on Safari but not the second one and we missed it. I've now tested on Chrome, Safari, Firefox and Edge. |
🚀 Deployed to production by https://github.com/chiragsalian in version: 1.3.17-5 🚀
|
Details
We have a regression after fixing jittery effect here.
Fixed Issues
$ #18878
$ #17555
PROPOSAL: GH_LINK_ISSUE(COMMENT)
Tests
Same as QA Steps
Offline tests
Same as QA Steps
QA Steps
Web/Desktop
Android/iOS/mWeb
Don't have tooltip
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Web
Screen.Recording.2023-05-17.at.11.54.42.mov
Mobile Web - Chrome
No tooltip
Mobile Web - Safari
No tooltip
Desktop
Screen.Recording.2023-05-17.at.11.59.18.mov
iOS
No tooltip
Android
No tooltip