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] mWeb - Compose box- Selected text isn't applied format #53145

Open
1 of 8 tasks
lanitochka17 opened this issue Nov 26, 2024 · 61 comments
Open
1 of 8 tasks

[$250] mWeb - Compose box- Selected text isn't applied format #53145

lanitochka17 opened this issue Nov 26, 2024 · 61 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Design External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Nov 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.67-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Y
**If this was caught during regression testing, add the test name, ID and link from TestRail:**N/A
Email or phone of affected tester (no customers): [email protected]

Action Performed:

  1. Open https://staging.new.expensify.com/
  2. At compose box of any conversation, type 1 line
  3. Select all text, choose Format: Bold and send message
  4. Type another line
  5. Select all text, choose Format: Italic and send message
  6. Type another line
  7. Select all text, choose Format: Underline and send message

Expected Result:

Selected texts should apply choosing format

Actual Result:

Selected texts isn't applied choosing format

Workaround:

Unknown

Platforms:

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

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
Bug6658637_1731058296145.Qotm2966_1_.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021861616540479439769
  • Upwork Job ID: 1861616540479439769
  • Last Price Increase: 2024-11-27
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Nov 26, 2024
Copy link

melvin-bot bot commented Nov 26, 2024

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

@kadiealexander kadiealexander added the External Added to denote the issue can be worked on by a contributor label Nov 27, 2024
Copy link

melvin-bot bot commented Nov 27, 2024

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

@melvin-bot melvin-bot bot changed the title mWeb - Compose box- Selected text isn't applied format [$250] mWeb - Compose box- Selected text isn't applied format Nov 27, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Nov 27, 2024
Copy link

melvin-bot bot commented Nov 27, 2024

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

@bernhardoj
Copy link
Contributor

Proposal

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

Selected text isn't formatted when selecting format option from the context menu.

What is the root cause of that problem?

When we have an element with contenteditable, the context menu will show the "Format" option. However, the live markdown currently doesn't handle the format command.

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

There are 3 "Format" options, Bold, Italic, and Underline. Currently, we don't have a markdown for Underline. To handle the Bold and Italic format, we need to add new cases for bold and italic format command here.
https://github.com/Expensify/react-native-live-markdown/blob/cec2feae7463398b8d377a231be8671e1698e4a0/src/MarkdownTextInput.web.tsx#L349-L358

case 'formatBold':
  newInputUpdate = parseText(
    divRef.current,
    `${parsedText.slice(0, contentSelection.current.start)}*${parsedText.slice(contentSelection.current.start, contentSelection.current.end)}*${parsedText.slice(contentSelection.current.end)}`,
    processedMarkdownStyle,
    newCursorPosition + 2,
    true
  );
  break
case 'formatItalic':
  newInputUpdate = parseText(
    divRef.current,
    `${parsedText.slice(0, contentSelection.current.start)}_${parsedText.slice(contentSelection.current.start, contentSelection.current.end)}_${parsedText.slice(contentSelection.current.end)}`,
    processedMarkdownStyle,
    newCursorPosition + 2,
    true
  );
  break

The way the format logic work is by "wrapping" the selected text with the markdown (* for bold, _ for italic). The new selection will be added by 2 because we add 2 * or _.

But the Underline format still won't do anything because we don't have a markdown for that, and because the live markdown also handles the styling manually, so the alternative is to disable the "Format" option. We can do that by setting the contenteditable to "plaintext-only"
https://github.com/Expensify/react-native-live-markdown/blob/cec2feae7463398b8d377a231be8671e1698e4a0/src/MarkdownTextInput.web.tsx#L724

contentEditable: disabled ? 'false' : 'plaintext-only',

Based on the doc, "plaintext-only" is available on most browsers except Firefox, but this Format context menu is only available on Safari, so I think it's not a problem.
https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/contenteditable#browser_compatibility

@mananjadhav
Copy link
Collaborator

Reviewing.

Copy link

melvin-bot bot commented Dec 2, 2024

@mananjadhav, @kadiealexander 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 Dec 2, 2024
@maddylewis maddylewis moved this to Product (CRITICAL) in [#whatsnext] #retain Dec 2, 2024
@kadiealexander
Copy link
Contributor

Bumped @mananjadhav for review here.

@mananjadhav
Copy link
Collaborator

I checked @bernhardoj's proposal. I think we can go ahead with this. But before we finalize I want to understand if we could remove the Underline option from the Format menu? (Atleast on Whatsapp I don't see it), whereas Slack removes the format option for me.

Nevertheless we can use @bernhardoj's proposal as they've mentioned the alternative for removing the Format menu as well.

Tagging @Expensify/design for the input as well.

🎀 👀 🎀 C+ reviewed.

@melvin-bot melvin-bot bot removed the Overdue label Dec 2, 2024
Copy link

melvin-bot bot commented Dec 2, 2024

Triggered auto assignment to @blimpich, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

Copy link

melvin-bot bot commented Dec 2, 2024

Triggered auto assignment to @dubielzyk-expensify (Design), see these Stack Overflow questions for more details.

@shawnborton
Copy link
Contributor

Oh interesting, I didn't even know you could do this from iOS. I suppose we could make it so that whatever style you picked from the native menu (bold, italic, etc) was applied via our markdown styles, as in we'd prepend and append a * if you picked bold. Is something like that possible?

@dubielzyk-expensify
Copy link
Contributor

That'd be great if that's possible. If not, I wonder if we could hide or turn off that formatting menu altogether.

@bernhardoj
Copy link
Contributor

I suppose we could make it so that whatever style you picked from the native menu (bold, italic, etc) was applied via our markdown styles, as in we'd prepend and append a * if you picked bold. Is something like that possible?

It's possible which is my main solution, however, the Format option includes Underline, but we don't have an underline markdown. I don't see a way to select which format to show, but we can hide entirely with my alternative solution.

@shawnborton
Copy link
Contributor

I think it's fine if we don't have an underline markdown for now, at least we'll get the benefit of bold and italic working.

@dannymcclain
Copy link
Contributor

I'm fine with making just bold and italic work or hiding that format menu item altogether. I also didn't even realize it was there haha.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production labels Jan 14, 2025
@melvin-bot melvin-bot bot changed the title [HOLD #55115][$250] mWeb - Compose box- Selected text isn't applied format [HOLD for payment 2025-01-21] [HOLD #55115][$250] mWeb - Compose box- Selected text isn't applied format Jan 14, 2025
Copy link

melvin-bot bot commented Jan 14, 2025

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.84-7 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2025-01-21. 🎊

For reference, here are some details about the assignees on this issue:

  • @mananjadhav requires payment through NewDot Manual Requests
  • @bernhardoj requires payment through NewDot Manual Requests

Copy link

melvin-bot bot commented Jan 14, 2025

@mananjadhav @kadiealexander @mananjadhav The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jan 21, 2025
Copy link

melvin-bot bot commented Jan 21, 2025

Payment Summary

Upwork Job

BugZero Checklist (@kadiealexander)

  • I have verified the correct assignees and roles are listed above and updated the neccesary manual offers
  • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1861616540479439769/hired)
  • I have paid out the Upwork contracts or cancelled the ones that are incorrect
  • I have verified the payment summary above is correct

@maddylewis maddylewis moved this from CRITICAL to HIGH in [#whatsnext] #retain Jan 21, 2025
@kadiealexander
Copy link
Contributor

@mananjadhav could you please complete the checklist?

@blimpich
Copy link
Contributor

@kadiealexander the PR ended up being reverted and this issue is now on hold, waiting for another issue to be completed first, so we need to wait to re-merge the PR before going through the bugzero checklist.

@blimpich blimpich removed the Awaiting Payment Auto-added when associated PR is deployed to production label Jan 23, 2025
@blimpich blimpich changed the title [HOLD for payment 2025-01-21] [HOLD #55115][$250] mWeb - Compose box- Selected text isn't applied format [HOLD #55115][$250] mWeb - Compose box- Selected text isn't applied format Jan 23, 2025
@kadiealexander
Copy link
Contributor

Thanks for that context!

@melvin-bot melvin-bot bot added the Overdue label Jan 27, 2025
Copy link

melvin-bot bot commented Jan 27, 2025

@mananjadhav, @blimpich, @bernhardoj, @kadiealexander, @dubielzyk-expensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@kadiealexander
Copy link
Contributor

Still waiting on #55115

@melvin-bot melvin-bot bot removed the Overdue label Jan 28, 2025
@kadiealexander kadiealexander added Weekly KSv2 and removed Daily KSv2 labels Jan 28, 2025
@shubham1206agra
Copy link
Contributor

PR is in production. Can you retest this issue? Since we added the changes reverted back.

@blimpich blimpich changed the title [HOLD #55115][$250] mWeb - Compose box- Selected text isn't applied format [$250] mWeb - Compose box- Selected text isn't applied format Jan 31, 2025
@blimpich
Copy link
Contributor

Asked for QA to retest here.

@kavimuru
Copy link

underline is not fixed yet. Bold and Itallic are fixed

ScreenRecording_01-31-2025.15-38-39_1.MP4

@mananjadhav
Copy link
Collaborator

I think we can track underline as a follow up. This was discussed earlier that for now we have only Bold and Italic support.

@blimpich
Copy link
Contributor

Sounds good. @mananjadhav we still need to pay out this issue correct?

@mananjadhav
Copy link
Collaborator

Yes, need a payout summary, @kadiealexander. While I'll work on the checklist.

@mananjadhav
Copy link
Collaborator

BugZero Checklist:

  • [Contributor] Classify the bug:
Bug classification

Source of bug:

  • 1a. Result of the original design (eg. a case wasn't considered)
  • 1b. Mistake during implementation
  • 1c. Backend bug
  • 1z. Other:

Where bug was reported:

  • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
  • 2b. Reported on staging (eg. found during regression or PR testing)
  • 2d. Reported on a PR
  • 2z. Other:

Who reported the bug:

  • 3a. Expensify user
  • 3b. Expensify employee
  • 3c. Contributor
  • 3d. QA
  • 3z. Other:
  • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

    Link to comment: NA

  • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

    Link to discussion: NA

  • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

Regression Test Proposal Template
  • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

    Link to issue:

Regression Test Proposal

Precondition:

Test:

Only for iOS mWeb Safari and Web Safari

  1. Open any chat
  2. Type anything on the composer
  3. Select some text on the composer
  4. Right-click or long-press to open the web context menu
  5. Select Format (iOS mWeb) or Font (Web Safari)
  6. Select Bold and Italic
  7. Verify the bold and italic markdown is added.

Do we agree 👍 or 👎

@mananjadhav
Copy link
Collaborator

@kadiealexander This is all set to be paid out.

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. Design External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
Status: HIGH
Development

No branches or pull requests

10 participants