-
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
[$250] Chat - Compose box stays in the middle when reduced with a several lines message #49541
Comments
Triggered auto assignment to @anmurali ( |
We think that this bug might be related to #wave-collect - Release 1 |
@anmurali FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors |
ProposalPlease re-state the problem that we are trying to solve in this issue.Chat - Compose box stays in the middle when reduced with a several lines message What is the root cause of that problem?When we toggle isComposerFullSize there is a code that sets the scrollTop to the previous scrollTop (the scrollTop in the previous isComposerFullSize state) App/src/components/Composer/index.tsx Lines 268 to 271 in 25450d9
so when the when the composer was full size the scroll top had a smaller value (that is because the composer had greater height and needs to scroll with smaller value to show the bottom of the composer than when it is non-full size) so when we switch it to non-full size that small value of scrollTop will not be enough to show the bottom of the composer. What changes do you think we should make in order to solve the problem?We need to set the scrollTop in such a way that the content on the bottom of the composer will be persitent on toggling isComposerFullSize so: we should add height state to hold previous clientHeight the change App/src/components/Composer/index.tsx Line 232 in 25450d9
App/src/components/Composer/index.tsx Lines 268 to 271 in 25450d9
What alternative solutions did you explore? (Optional)We if we want the center of the content persistent we can change
|
@anmurali Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
Job added to Upwork: https://www.upwork.com/jobs/~021838742813045152105 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @rayane-djouah ( |
@anmurali, @rayane-djouah Eep! 4 days overdue now. Issues have feelings too... |
Sorry for the delay! will review this one later today / tomorrow |
ProposalPlease re-state the problem that we are trying to solve in this issue.Composer's caret scroll position is not maintained after resuming from expanded mode. What is the root cause of that problem?The line below maintains the App/src/components/Composer/index.tsx Line 269 in 526845b
What changes do you think we should make in order to solve the problem?In Chrome, if the caret is not visible, after typing a charector, the caret will be scrolled to the visible area. We can implement similar behavior by replacing the above line with the code below. const selectionRect = window.getSelection()?.getRangeAt(0).getBoundingClientRect();
const textInputRect = textInput.current.getBoundingClientRect();
if (selectionRect && (selectionRect.top < textInputRect.top || selectionRect.bottom > textInputRect.bottom)) {
textInput.current.scrollTop += selectionRect.top - textInputRect.top;
} else {
// eslint-disable-next-line react-compiler/react-compiler
textInput.current.scrollTop = prevScroll;
} What alternative solutions did you explore? (Optional)In Chrome, after you blur and focus the Composer, the caret will be scrolled into the visible area. We can emulate this behavior by inserting the code below after the line mentioned in the root cause. const selectionRect = window.getSelection()?.getRangeAt(0).getBoundingClientRect();
const textInputRect = textInput.current.getBoundingClientRect();
if (selectionRect && (selectionRect.top < textInputRect.top || selectionRect.bottom > textInputRect.bottom)) {
textInput.current.blur();
textInput.current.focus();
} |
Could we clarify the expected behavior? Since some content has to be hidden after shrinking the
|
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
Good question! @Expensify/design Could you clarify the expected result? The video below demonstrates the current behavior, where we keep the first visible line in view when resizing the composer. In my opinion, we should scroll to the caret position instead. What do you think? Screen.Recording.2024-10-02.at.5.16.35.PM.mov |
Hmm, what's shown in the video honestly doesn't feel weird to me. It kinda looks like we're "respecting" the scroll position that was already there. But I also think it could make sense to always show the cursor/caret. So I think personally I'd opt for one of those two options. Let's see what @dubielzyk-expensify thinks! |
@rayane-djouah If a user has scrolled up from where the cursor is located and switches the composer size I doubt if the user expects it to be scrolled to the caret position. What I think and based my proposal on was we should as much as possible make the visible content of the composer consistent across the two composer size states. Currently, we are making the top content consistent on toggling composer size that's why we facing the current issue. So we can make the bottom or middle of content consistent instead. @dannymcclain WDYT |
I actually think we should respect the scroll position over the caret here. Cause I think you'd expect the view to expand not for the view to shift and follow the caret. I vote scroll position 👍 |
Ok thanks @dubielzyk-expensify! That makes me think that our current behavior is what we want (keep the first visible line in view when resizing). Do you agree? |
The logic of the expected result in the OP is that switching to full-size and back to normal-size, they expected the content visible to be on the same scroll level it was before toggling to full-size. This happens in most cases but when the scroll level is the down-end, when the user changes to full-size, the top line when it was non-full sized will now be in the middle on full-size (obviously b/c full-size will accomodate more content) so when swiching back to non-full sized it will keep the first line in view so it will be in a scrolled-up state than it was originally, which kind of unexpected. |
Ahhh right. I see what you mean now. I guess because the text grows from bottom up it feels weird that we align the scroll position to the top of the compose bar. Okay I think I get it. In that instance I guess I think we should make sure that it follows the bottom of the compose bar. So when you expand, the last line should stay the same. That way you never get into a weird thing where you're at the bottom of the compose bar, expand it, and you lose your position. Does that sound right? |
Yeah that sounds good to me! I guess for the composer the bottom is really the "anchor" so what you're suggesting makes sense. |
@anmurali @rayane-djouah this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks! |
Thanks for clarifying the expected result |
@anmurali, @rayane-djouah Whoops! This issue is 2 days overdue. Let's get this updated quick! |
Triggered auto assignment to @marcaaron, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
📣 @rayane-djouah 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app! |
📣 @FitseTLT 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Offer link |
PR under review |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 9.0.39-0
Reproducible in staging?: Y
Reproducible in production?: Y
Issue reported by: Applause Internal Team
Action Performed:
Expected Result:
When the compose box with a written message of several lines is reduced in size, the user should be scrolled to the bottom of it.
Actual Result:
When the compose box with a written message of several lines is reduced in size, the user is not scrolled to the bottom. The compose box is displayed in the middle of the message.
Workaround:
Unknown
Platforms:
Screenshots/Videos
Bug6609918_1726836461310.Compose_Reduce.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @rayane-djouahThe text was updated successfully, but these errors were encountered: