-
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
fix chat-link in end of line displays tooltip over text and not on link #29134
fix chat-link in end of line displays tooltip over text and not on link #29134
Conversation
This comment was marked as off-topic.
This comment was marked as off-topic.
@ Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Recheck |
@s77rt It's all resolved, you can recheck. Thanks. |
Reviewer Checklist
Screenshots/VideosWebweb.movMobile Web - ChromeMobile Web - SafariDesktopdesktop.moviOSAndroid |
@teneeto Thanks! |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
Performance Comparison Report 📊Significant Changes To Duration
Show details
Meaningless Changes To DurationShow entries
Show details
|
@Expensify/mobile-deployers 📣 Please look into this performance regression as it's a deploy blocker. |
// multiple lines, we want to show the tooltip over the part | ||
// of the link that the user is hovering over. | ||
const betterBounds = chooseBoundingBox(target.current, initialMousePosition.current.x, initialMousePosition.current.y); | ||
setWrapperWidth(betterBounds.width); |
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.
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.
Yes it's, more info #29446 (comment) and PR fixing it #29468
🚀 Deployed to staging by https://github.com/pecanoro in version: 1.3.84-0 🚀
|
🚀 Deployed to production by https://github.com/francoisl in version: 1.3.84-10 🚀
|
🚀 Deployed to production by https://github.com/francoisl in version: 1.3.84-10 🚀
|
🚀 Deployed to staging by https://github.com/pecanoro in version: 1.3.85-0 🚀
|
🚀 Deployed to production by https://github.com/francoisl in version: 1.3.85-4 🚀
|
const initialMousePosition = useRef({x: 0, y: 0}); | ||
|
||
const updateTargetAndMousePosition = useCallback((e) => { | ||
target.current = e.target; |
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.
We should have used the currentTarget
(the element that is listening to the mouse enter event) instead of target
(the element that caused the event to fire and bubble up). Coming from #29678
Details
This PR seeks to address the reviews of a previously authored and closed PR
Referencing the leading solution #27817 (comment)
Add a new prop to Tooltip called shouldUseMultilinePositioning. This enables a new algorithm for finding the bounding box target for the tooltip. In the case where the target has wrapped onto multiple lines (e.g. it is a link in a chat window) then the link has multiple bounding boxes, and we want to show the tooltip against the one that the user is hovering over.
As part of this, extend Hoverable to pass the Event to its onHoverIn / onHoverOut callbacks.
Enable this new algorithm from BaseAnchorForCommentsOnly, which is the base class for links that show up in chat.
Fixed Issues
$ #27585
PROPOSAL: #27585
Tests
Referencing the leading solution #27817 (comment)
Action Performed:
On a platform with a mouse (i.e. not mobile):
Open the app
Open any report
Type in some text and at the end of line, add link with long text eg: Test test test test test test test test test test
Send the text, text should have text and link in first line and link should be continued in second line too. Adjust the window size to force the text to wrap if necessary.
Hover on link and observe that tooltip is displayed over text
Expected Result:
App should display tooltip over link on hover. The tooltip should appear over the same section of the link that the user is hovering over.
Offline tests
QA Steps
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-10-10.at.01.14.37.mov
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android