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. |
tgolen
left a comment
There was a problem hiding this comment.
Nice, thanks for those few changes.
|
@bernhardoj There are conflicts now, please resolve when you get a chance 😄 |
mananjadhav
left a comment
There was a problem hiding this comment.
changes look good, can we please resolve the conflicts @bernhardoj? I can start testing then.
|
Conflicts solved |
| const tooltipHeight = tooltipContentHeight && tooltipContentHeight + tooltipVerticalPadding.paddingVertical * 2; | ||
|
|
||
| // 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.
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..
mananjadhav
left a comment
There was a problem hiding this comment.
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 Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.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