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

[HOLD for payment 2024-01-04] [$500] Android - Chat - Message gets displayed from right to left #30584

Closed
1 of 6 tasks
lanitochka17 opened this issue Oct 30, 2023 · 74 comments
Closed
1 of 6 tasks
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Engineering External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Oct 30, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 1.3.93-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:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:

Issue found when executing PR #30521

Action Performed:

  1. Launch App
  2. Open any chat and paste an RTL text in the compose box, for example " مثال "
  3. Continue typing some content

Expected Result:

Verify that the content gets displayed from left to right

Actual Result:

The content gets displayed from right to left

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

Android: Native

Bug6256757_1698673344323!30521_Android

Bug6256757_1698673344303.30521_Android.mp4
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01278feafdf81fcb73
  • Upwork Job ID: 1718998877593833472
  • Last Price Increase: 2023-11-20
  • Automatic offers:
    • samilabud | Contributor | 27900958
Issue OwnerCurrent Issue Owner: @johncschuster
@lanitochka17 lanitochka17 added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 30, 2023
@melvin-bot melvin-bot bot changed the title Android - Chat - Message gets displayed from right to left [$500] Android - Chat - Message gets displayed from right to left Oct 30, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 30, 2023

Triggered auto assignment to @johncschuster (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Oct 30, 2023

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

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

melvin-bot bot commented Oct 30, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@melvin-bot
Copy link

melvin-bot bot commented Oct 30, 2023

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

@Krishna2323

This comment was marked as resolved.

@situchan
Copy link
Contributor

cc: @HardikChoudhary24

@HardikChoudhary24
Copy link
Contributor

HardikChoudhary24 commented Oct 30, 2023

For android it will be working like that it is mentioned in comment. Also this can be seen for other apps like linkedin where the web version is having the desired result and their android app is not showing it in LTR format

@allroundexperts
Copy link
Contributor

Hm... @HardikChoudhary24 I see your comment, but I think this is still a bug. I guess we can keep this open and see if we can get a concrete fix in place?

@HardikChoudhary24
Copy link
Contributor

HardikChoudhary24 commented Oct 30, 2023

Sure @allroundexperts but this is something that is not supported in android as per my knowledge. This can be seen in other apps like LinkedIn, discord, and Puma. These are the ones that I have tested and found that they are displaying it in the desired format on web but not on native android.

@samilabud
Copy link
Contributor

samilabud commented Oct 30, 2023

Proposal

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

Chat - Message gets displayed from right to left

What is the root cause of that problem?

The root cause is that Android only converts RTL text to LTR text using Unicode controls and by default, when you start writing in a language that is written in RTL mode it converts the input text to RTL.

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

The best solution is to add \u2066 unicode character before starting to write, I suggest verifying (when the user is using Android) if the input value is empty and doing the next in the ComposerWithSuggestions component:

https://github.com/Expensify/App/blob/5d45f0f6c86e97d4ae58ac167b6c162a610b817c/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions.js.

useEffect(() => {
        if (value === '') {
            setValue(convertToLTR(value));
        }
    }, [value]);

The convertToLTR function adds the unicode character needed for this to work in Android.

This way the input in Android never changes to direction = RTL, please see the result:

Android.chat.messgage.gets.displayed.from.right.to.left.done.mov

@samilabud
Copy link
Contributor

Proposal

Updated

@melvin-bot melvin-bot bot added the Overdue label Nov 2, 2023
@johncschuster
Copy link
Contributor

@allroundexperts can you take a look at the updated proposal above when you get a moment?

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Nov 2, 2023
Copy link

melvin-bot bot commented Nov 6, 2023

@johncschuster, @allroundexperts Whoops! This issue is 2 days overdue. Let's get this updated quick!

Copy link

melvin-bot bot commented Nov 6, 2023

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

@allroundexperts
Copy link
Contributor

@samilabud's proposal seems to work well.

@HardikChoudhary24 did you explore this solution before? If so, do you know if it has some shortcomings? cc @situchan as well since you seem to have been involved in that conversation.

@melvin-bot melvin-bot bot removed the Overdue label Nov 7, 2023
@fabOnReact
Copy link
Contributor

Proposal

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

The text is displayed right to left.

What is the root cause of that problem?

The ReactRoot view default textDirection is firstStrong (screenshot1, screenshot2)

https://developer.android.com/reference/android/view/View.html#attr_android:textDirection

firstStrong
Default for the root view. The first strong directional character determines the paragraph direction. 
If there is no strong directional character, the paragraph direction is the view\u2019s resolved layout direction.
  • The text مثالa displays as left-to-right
  • The text aمثال displays as right-to-left

Testing textDirection: firstStrong and textDirection: ltr on Android

https://developer.android.com/reference/android/view/View.html#attr_android:textDirection

https://github.com/fabriziobertoglio1987/text-input-cursor-flickering-android/blob/31db5796c6abbd17ffaa87de1663c38604d1da33/app/src/main/java/com/example/javaexample/CustomEditText.java#L29-L43

TextDirection firstStrong TextDirection ltr

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

Expose textDirection style prop in the React Native API to allow changing the Views (View, TextInput, Text) textDirection.

  1. Add a JavaScript textDirection style prop to the React Native API:
<View style={{textDirection: "ltr"}}>
   <TextInput style={{textDirection: "inherit"}}>The TextInput inherits the style from the parent</TextInput>
   <TextInput style={{textDirection: "firstStrong"}}>The TextInput content aligns based on the first character content</TextInput>
</View>
  1. Set the textDirection of the Android View using setTextDirection (android code snippet).

Copy link

melvin-bot bot commented Nov 10, 2023

@johncschuster, @allroundexperts Whoops! This issue is 2 days overdue. Let's get this updated quick!

@melvin-bot melvin-bot bot added the Overdue label Nov 10, 2023
@johncschuster
Copy link
Contributor

Payment Summary:

@samilabud - $500 - paid via Upwork (Contributor)
@allroundexperts - $500 - requires payment through NewDot Manual Requests

@situchan
Copy link
Contributor

situchan commented Jan 5, 2024

Original PR was reverted due to regression and 2nd PR is still in review

@melvin-bot melvin-bot bot added the Overdue label Jan 8, 2024
Copy link

melvin-bot bot commented Jan 8, 2024

@tgolen, @samilabud, @johncschuster, @allroundexperts Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@johncschuster
Copy link
Contributor

Sorry I missed that, @situchan. Thanks for raising the PR under review!

@melvin-bot melvin-bot bot removed the Overdue label Jan 9, 2024
@johncschuster johncschuster added Weekly KSv2 and removed Daily KSv2 labels Jan 9, 2024
@melvin-bot melvin-bot bot added the Overdue label Jan 18, 2024
@johncschuster
Copy link
Contributor

PR to fix the regression is still under review

@melvin-bot melvin-bot bot removed the Overdue label Jan 18, 2024
@melvin-bot melvin-bot bot added the Overdue label Jan 29, 2024
@tgolen
Copy link
Contributor

tgolen commented Jan 29, 2024

Regression fix PR is still under review.

@melvin-bot melvin-bot bot removed the Overdue label Jan 29, 2024
@melvin-bot melvin-bot bot added the Overdue label Feb 6, 2024
@johncschuster
Copy link
Contributor

^Same

@melvin-bot melvin-bot bot removed the Overdue label Feb 6, 2024
@melvin-bot melvin-bot bot added the Overdue label Feb 15, 2024
@johncschuster
Copy link
Contributor

Same

@melvin-bot melvin-bot bot removed the Overdue label Feb 15, 2024
@melvin-bot melvin-bot bot added the Overdue label Feb 26, 2024
@tgolen
Copy link
Contributor

tgolen commented Feb 26, 2024

I bumped the PR to see what's going on with this one. The PR hasn't been updated in a month.

@melvin-bot melvin-bot bot removed the Overdue label Feb 26, 2024
@johncschuster
Copy link
Contributor

Thanks for doing that, @tgolen! It hadn't occurred to me to bump the PR. I'll do that myself going forward.

@tgolen
Copy link
Contributor

tgolen commented Feb 28, 2024

Sounds good! Yep, commenting on the PRs as the BZ person to try and figure out what's going on is always fair game. Hopefully, we will get a response. Next step if we don't is to ping them on Slack or NewDot and try to get a response directly.

@allroundexperts
Copy link
Contributor

@tgolen This was being discussed internally here. I think we need to think of a new solution or just do nothing here.

@tgolen
Copy link
Contributor

tgolen commented Mar 4, 2024

@allroundexperts thanks for the reminder about that thread. I think it's probably best to close this for now until we decide we want to have full support for RTL languages. There would be a whole host of things we would need to consider such as:

  • Message alignment
  • UI alignment
  • Window positioning (like modals)

I will go ahead and close this for now.

@tgolen tgolen closed this as completed Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Engineering External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
None yet
Development

No branches or pull requests

10 participants