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

[$250] Web - Chat - When editing last message, edition composer is cut in half by main composer #49787

Open
1 of 6 tasks
lanitochka17 opened this issue Sep 26, 2024 · 43 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors Overdue

Comments

@lanitochka17
Copy link

lanitochka17 commented Sep 26, 2024

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.40-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/5006320&group_by=cases:section_id&group_order=asc&group_id=292106
Issue reported by: Applause - Internal Team

Action Performed:

  1. Open the staging.new.expensify.com website
  2. Open any chat with long history
    3.Right click on the last sent message
  3. Click on "Edit Message
  4. Verify the edition composer, is fully visible

Expected Result:

When editing the last sent message on a chat, the edition composer, should be fully visible

Actual Result:

When the user edits the last message on a chat with long history, the edition composer, gets cutted in half by the main compose box

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6615545_1727314558189.Cut_compose.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021843415078855833463
  • Upwork Job ID: 1843415078855833463
  • Last Price Increase: 2024-11-18
Issue OwnerCurrent Issue Owner: @abdulrahuman5196
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 26, 2024
Copy link

melvin-bot bot commented Sep 26, 2024

Triggered auto assignment to @VictoriaExpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@lanitochka17
Copy link
Author

@VictoriaExpensify 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

@MuaazArshad
Copy link
Contributor

MuaazArshad commented Sep 26, 2024

Proposal

Please re-state the problem that we are trying to solve in this issue.

Web - Chat - When editing last message, edition composer is cutted in half by main composer

What is the root cause of that problem?

We are currently using the built-in View component from React Native here.

<View style={[StyleUtils.getContainerComposeStyles(), styles.textInputComposeBorder]}>
<Composer
multiline
ref={(el: TextInput & HTMLTextAreaElement) => {
textInputRef.current = el;
if (typeof forwardedRef === 'function') {
forwardedRef(el);
} else if (forwardedRef) {
// eslint-disable-next-line no-param-reassign
forwardedRef.current = el;
}
}}
id={messageEditInput}
onChangeText={updateDraft} // Debounced saveDraftComment
onKeyPress={triggerSaveOrCancel}
value={draft}
maxLines={shouldUseNarrowLayout ? CONST.COMPOSER.MAX_LINES_SMALL_SCREEN : CONST.COMPOSER.MAX_LINES} // This is the same that slack has
style={[styles.textInputCompose, styles.flex1, styles.bgTransparent]}
onFocus={() => {
setIsFocused(true);
InteractionManager.runAfterInteractions(() => {
requestAnimationFrame(() => {
reportScrollManager.scrollToIndex(index, true);
});
});
setShouldShowComposeInputKeyboardAware(false);
// The last composer that had focus should re-gain focus
setUpComposeFocusManager();
// Clear active report action when another action gets focused
if (!EmojiPickerAction.isActive(action.reportActionID)) {
EmojiPickerAction.clearActive();
}
if (!ReportActionContextMenu.isActiveReportAction(action.reportActionID)) {
ReportActionContextMenu.clearActiveReportAction();
}
}}
onBlur={(event: NativeSyntheticEvent<TextInputFocusEventData>) => {
setIsFocused(false);
const relatedTargetId = event.nativeEvent?.relatedTarget?.id;
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
if ((relatedTargetId && [messageEditInput, emojiButtonID].includes(relatedTargetId)) || EmojiPickerAction.isEmojiPickerVisible()) {
return;
}
setShouldShowComposeInputKeyboardAware(true);
}}
onLayout={reportActionItemEventHandler.handleComposerLayoutChange(reportScrollManager, index)}
selection={selection}
onSelectionChange={(e) => setSelection(e.nativeEvent.selection)}
isGroupPolicyReport={isGroupPolicyReport}
shouldCalculateCaretPosition
onScroll={onSaveScrollAndHideSuggestionMenu}
/>
</View>

What changes do you think we should make in order to solve the problem?

We should use ScrollView to ensure proper scrolling behaviour.
Sudo Code:

                <ScrollView style={[StyleUtils.getContainerComposeStyles(), styles.textInputComposeBorder]}>
                        //.......
                    </ScrollView>

What alternative solutions did you explore? (Optional)

@daledah
Copy link
Contributor

daledah commented Sep 26, 2024

Proposal

Please re-state the problem that we are trying to solve in this issue.

When the user edits the last message on a chat with long history, the edition composer, gets cutted in half by the main compose box

What is the root cause of that problem?

We already had the logic to focus on the edit composer in

focusComposerWithDelay(textInputRef.current)(true);

Even though, we use focusComposerWithDelay within shouldDelay: true but it just check the ComposerFocusManager.isReadyToFocus() and isWindowReadyToFocus()

Promise.all([ComposerFocusManager.isReadyToFocus(), isWindowReadyToFocus()]).then(() => {

When the input is focus, the view automatically scrolls to that input, but we need to wait for composer edit animation end before focusing on the input. We did the same in many places, especially in useAutoFocusInput hook

What changes do you think we should make in order to solve the problem?

Update this line

to

setTimeout(()=>{
            focusComposerWithDelay(textInputRef.current)(true);
        },CONST.ANIMATED_TRANSITION)

What alternative solutions did you explore? (Optional)

We can delay focus in focusComposerWithDelay if shouldDelay is true

Result

Screen.Recording.2024-09-26.at.22.45.30.mov

@melvin-bot melvin-bot bot added the Overdue label Sep 30, 2024
@VictoriaExpensify
Copy link
Contributor

I haven't had a chance to look at this yet, will take a look tomorrow

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Sep 30, 2024
@VictoriaExpensify
Copy link
Contributor

VictoriaExpensify commented Oct 2, 2024

Unable to reproduce this issue:

2024-10-03_07-53-12 (1)

@VictoriaExpensify
Copy link
Contributor

VictoriaExpensify commented Oct 2, 2024

@MuaazArshad - were you able to reproduce this?

@VictoriaExpensify
Copy link
Contributor

@MuaazArshad
Copy link
Contributor

@MuaazArshad - were you able to reproduce this?

Yes, and still reproducible.

Screen.Recording.2024-10-03.at.5.41.24.PM.mov

@m-natarajan
Copy link

Able to reproduce

screen-20241004-104821.mp4

@melvin-bot melvin-bot bot added the Overdue label Oct 7, 2024
@VictoriaExpensify VictoriaExpensify added External Added to denote the issue can be worked on by a contributor and removed Overdue labels Oct 7, 2024
@melvin-bot melvin-bot bot added the Overdue label Oct 7, 2024
@melvin-bot melvin-bot bot changed the title Web - Chat - When editing last message, edition composer is cutted in half by main composer [$250] Web - Chat - When editing last message, edition composer is cutted in half by main composer Oct 7, 2024
Copy link

melvin-bot bot commented Oct 7, 2024

Job added to Upwork: https://www.upwork.com/jobs/~021843415078855833463

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 7, 2024
Copy link

melvin-bot bot commented Oct 7, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @abdulrahuman5196 (External)

Copy link

melvin-bot bot commented Oct 28, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@melvin-bot melvin-bot bot added the Overdue label Oct 28, 2024
Copy link

melvin-bot bot commented Oct 28, 2024

@abdulrahuman5196, @VictoriaExpensify Huh... This is 4 days overdue. Who can take care of this?

@wildan-m
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

When editing the last message in the web chat, the edition composer is cut in half by the main composer.

What is the root cause of that problem?

When we press edit, the offset position of scroll is not perfectly pointed to the reportAction item, since the ReportActionItem and ReportActionItemMessageEdit might have different height this make the editor position might a little cut.

I can consistently reproduce the issue with the following step

  1. Open the app
  2. Create a message with 2 or more lines
  3. Scroll to the top of text ensure 2nd and the last message content hidden
  4. Right click on the last sent message
  5. Click on "Edit Message

What changes do you think we should make in order to solve the problem?

To ensure proper offset position while editing, scroll to the start of the edited report action when it's the last report action. It may be necessary to remove index === 0 based on the desired outcome.

Modify this useEffect

useEffect(() => {
if (prevDraftMessage !== undefined || draftMessage === undefined) {
return;
}
focusComposerWithDelay(textInputRef.current)(true);
}, [prevDraftMessage, draftMessage]);

To

    useEffect(() => {
        if (prevDraftMessage !== undefined || draftMessage === undefined) {
            return;
        }

        if(index === 0)
        {
            InteractionManager.runAfterInteractions(() => {
                requestAnimationFrame(() => {
                    reportScrollManager.scrollToIndex(index);
                });
            })
        }

        focusComposerWithDelay(textInputRef.current)(true);
    }, [prevDraftMessage, draftMessage]);

Ensure proper scrolling functionality by using runAfterInteractions and requestAnimationFrame, which are also utilized in other sections.

Result -- Before(left) - After(Right)

Kapture.2024-10-29.at.13.23.51.mp4

Branch for this solution

What alternative solutions did you explore? (Optional)

N/A

@wildan-m
Copy link
Contributor

I am unable to reproduce this issue. Any way to reproduce this reliabily?

@abdulrahuman5196 you might find the answer in my proposal #49787 (comment)

@VictoriaExpensify VictoriaExpensify added the retest-weekly Apply this label if you want this issue tested on a Weekly basis by Applause label Oct 29, 2024
@VictoriaExpensify
Copy link
Contributor

I haven't been able to reproduce the issue. Applying the retest label

@melvin-bot melvin-bot bot removed the Overdue label Oct 29, 2024
@wildan-m
Copy link
Contributor

@VictoriaExpensify can you test with this reproduction steps?

I can consistently reproduce the issue with the following step

  1. Open the app
  2. Create a message with 2 or more lines
  3. Scroll to the top of text ensure 2nd and the last message content hidden
  4. Right click on the last sent message
  5. Click on "Edit Message

Reproduction video and result can be seen here #49787 (comment)

@MuaazArshad
Copy link
Contributor

Able to reproduce using the provided steps.

Screen.Recording.2024-10-30.at.6.08.24.PM.mov

Copy link

melvin-bot bot commented Nov 1, 2024

@abdulrahuman5196, @VictoriaExpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@melvin-bot melvin-bot bot added the Overdue label Nov 1, 2024
Copy link

melvin-bot bot commented Nov 4, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

Copy link

melvin-bot bot commented Nov 5, 2024

@abdulrahuman5196, @VictoriaExpensify 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

Copy link

melvin-bot bot commented Nov 11, 2024

@abdulrahuman5196, @VictoriaExpensify 12 days overdue. Walking. Toward. The. Light...

Copy link

melvin-bot bot commented Nov 11, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

Copy link

melvin-bot bot commented Nov 12, 2024

@abdulrahuman5196, @VictoriaExpensify 12 days overdue. Walking. Toward. The. Light...

@VictoriaExpensify
Copy link
Contributor

Yup, this is reproducible following the steps given. Let's move forward here

@VictoriaExpensify VictoriaExpensify removed the retest-weekly Apply this label if you want this issue tested on a Weekly basis by Applause label Nov 13, 2024
@abdulrahuman5196
Copy link
Contributor

abdulrahuman5196 commented Nov 13, 2024

Hi, I am still unable to repro the issue. I reached out in C+ channel to see if any one is able to repro this and takeover.
https://expensify.slack.com/archives/C02NK2DQWUX/p1731523034411719

@melvin-bot melvin-bot bot removed the Overdue label Nov 13, 2024
@allroundexperts
Copy link
Contributor

I was able to reproduce. Will post a video shortly as well.

@allroundexperts
Copy link
Contributor

Was able to reproduce:

Screen.Recording.2024-11-14.at.3.25.31.AM.mov

@allroundexperts
Copy link
Contributor

@VictoriaExpensify Can you please assign this to me?

@abdulrahuman5196
Copy link
Contributor

@VictoriaExpensify Kindly assign this issue to @allroundexperts for takeover. Unassigned myself.

@abdulrahuman5196 abdulrahuman5196 removed their assignment Nov 14, 2024
@melvin-bot melvin-bot bot added the Overdue label Nov 18, 2024
Copy link

melvin-bot bot commented Nov 18, 2024

@VictoriaExpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

Copy link

melvin-bot bot commented Nov 18, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors Overdue
Projects
Status: No status
Development

No branches or pull requests

8 participants