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

[$125] mWeb - Chat - When deleting mention in second line, suggestions overlap the message #50588

Closed
1 of 6 tasks
lanitochka17 opened this issue Oct 10, 2024 · 9 comments
Closed
1 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. 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 Weekly KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Oct 10, 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.47
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team

Action Performed:

  1. Open the staging.new.expensify.com website
  2. Open any chat
  3. In compose box, mention other users until one mention is displayed in second line
  4. Start deleting the last mention, until it is moved to the first message line
  5. Verify the mention suggestions box, is also moved so it doesn´t overlap the message in compose box

Expected Result:

When the user is deleting a mention displayed in second line, and this mention is moved to the first line of the message, the suggestion box should also be moved, so it doesn´t overlap the written message in compose box

Actual Result:

When the user is deleting a mention displayed on the second line of the compose box, and this mention is moved to the first line of the message, the suggestion box, is not moved and overlaps the message

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
Bug6618061_1727491687772.Mentions.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021846354279628509557
  • Upwork Job ID: 1846354279628509557
  • Last Price Increase: 2024-10-16
Issue OwnerCurrent Issue Owner: @brunovjk
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 10, 2024
Copy link

melvin-bot bot commented Oct 10, 2024

Triggered auto assignment to @twisterdotcom (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.

@bernhardoj
Copy link
Contributor

Proposal

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

When removing mention characters that makes the line reduces, the suggestion overlaps with the message.

What is the root cause of that problem?

The position of the suggestion is based on the invisible text here which renders value after caret (|) here.

<Text style={[StyleSheet.flatten([style, styles.noSelect]), StyleUtils.getComposerMaxHeightStyle(maxLines, isComposerFullSize), {maxWidth: textInputWidth}]}>
{`${valueBeforeCaret} `}
<Text
numberOfLines={1}
ref={textRef}
>
{`${caretContent}`}
</Text>
</Text>

The value after caret is updated on every selection change by taking the substring of the value state.

const addCursorPositionToSelectionChange = (event: NativeSyntheticEvent<TextInputSelectionChangeEventData>) => {
const webEvent = event as BaseSyntheticEvent<TextInputSelectionChangeEventData>;
if (shouldCalculateCaretPosition && isRendered) {
// we do flushSync to make sure that the valueBeforeCaret is updated before we calculate the caret position to receive a proper position otherwise we will calculate position for the previous state
flushSync(() => {
setValueBeforeCaret((webEvent.target as HTMLInputElement).value.slice(0, webEvent.nativeEvent.selection.start));
setCaretContent(getNextChars(value ?? '', webEvent.nativeEvent.selection.start));
});

However, when the selection change is triggered, the value isn't updated yet. So, the value after caret (caretContent) contains an incorrect value. For example, if I type.

@bernhard.josephus+9999@ // first line
g // second line

The invisible text will also be 2 line. Then removes the last g, the selection change is triggered, but the value is still @bernhard.josephus+9999@g, so the value before caret is @bernhard.josephus+9999@ and the value after caret is g and because g is on the second line, the suggestion position overlaps the message.

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

We need to get the input value directly from the element just like what we did when calculating the value before caret.

flushSync(() => {
setValueBeforeCaret((webEvent.target as HTMLInputElement).value.slice(0, webEvent.nativeEvent.selection.start));
setCaretContent(getNextChars(value ?? '', webEvent.nativeEvent.selection.start));
});

flushSync(() => {
    setValueBeforeCaret((webEvent.target as HTMLInputElement).value.slice(0, webEvent.nativeEvent.selection.start));
    setCaretContent(getNextChars((webEvent.target as HTMLInputElement).value ?? '', webEvent.nativeEvent.selection.start));
});

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

melvin-bot bot commented Oct 15, 2024

@twisterdotcom Huh... This is 4 days overdue. Who can take care of this?

@twisterdotcom
Copy link
Contributor

Niche, so making only 125.

@melvin-bot melvin-bot bot removed the Overdue label Oct 16, 2024
@twisterdotcom twisterdotcom added the External Added to denote the issue can be worked on by a contributor label Oct 16, 2024
@melvin-bot melvin-bot bot changed the title mWeb - Chat - When deleting mention in second line, suggestions overlap the message [$250] mWeb - Chat - When deleting mention in second line, suggestions overlap the message Oct 16, 2024
Copy link

melvin-bot bot commented Oct 16, 2024

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

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

melvin-bot bot commented Oct 16, 2024

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

@twisterdotcom twisterdotcom added Weekly KSv2 and removed Daily KSv2 labels Oct 16, 2024
@twisterdotcom twisterdotcom changed the title [$250] mWeb - Chat - When deleting mention in second line, suggestions overlap the message [$125] mWeb - Chat - When deleting mention in second line, suggestions overlap the message Oct 16, 2024
Copy link

melvin-bot bot commented Oct 16, 2024

Upwork job price has been updated to $125

@brunovjk
Copy link
Contributor

I couldn't reproduce it on Desktop Web, iOS mWeb and Android mWeb (v9.0.49-1) :

Screen.Recording.2024-10-16.at.11.55.53.mov

@lanitochka17 would you mind retesting? Thanks a lot.

@bernhardoj
Copy link
Contributor

I think it's not repro anymore after #50711

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. 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 Weekly KSv2
Projects
Status: No status
Development

No branches or pull requests

4 participants