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

fix: IOU - one character descriptions are not saved #343

Closed
wants to merge 4 commits into from

Conversation

charles-liang
Copy link

@charles-liang charles-liang commented May 8, 2024

@sobitneupane @BartoszGrajdek

Details

This PR avoid the incorrect behavior of the keyboard during auto-complete on Android mWeb.
The main changes are:
Add a condition, when the startComposition event trigger, whether the type of text change is 'insertCompositionText'. If confirmed, then execute the logic of Composition.

Related Issues

Issues IOU - one character descriptions are not saved
Proposal

Manual Tests

On Android mWeb

  1. Navigate to staging.new.expensify.com
  2. Click on FAB > Submit expense > Manual
  3. Input an amount
  4. Select a user
  5. Click on "Description"
    "The system keyboard must be set to predictive text mode, or what's called autocomplete mode. Just type a few characters."
  6. Click save when the system's predictive text is active.

Linked PRs

Tested

  1. Mac Chrome/Safari
2.mov
  1. Android mWeb
default.mov

Copy link

github-actions bot commented May 8, 2024

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@charles-liang
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

@BartoszGrajdek
Copy link
Collaborator

There's a problem here - the diacritic inside a bold block doesn't work (video below)

Screen.Recording.2024-05-10.at.13.38.15.mov

@charles-liang
Copy link
Author

@BartoszGrajdek I have added a condition to fix it.
Are there any test cases you can share with me for testing together? In order to reducing the cost of communication?

@sobitneupane
Copy link

@charles-liang Can you please add screenshots of your tests in PR body?


if (compositionRef.current) {
const nativeEvent = e.nativeEvent as MarkdownNativeEvent;
if (compositionRef.current && (nativeEvent.inputType !== 'insertCompositionText' || nativeEvent.data !== '*')) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I doubt it will function properly if the single character entered is * here

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when it's just a single character '*', the previous condition composition.current is false.

@charles-liang
Copy link
Author

@charles-liang Can you please add screenshots of your tests in PR body?

Ok, I will add it today.

@charles-liang
Copy link
Author

@sobitneupane Already added the test of the original issue and the test case your comment mentioned

@sobitneupane
Copy link

  1. Navigate to staging.new.expensify.com
  2. Click on FAB > Submit expense > Manual
  3. Input an amount
  4. Select a user
  5. Click on "Description"
    "The system keyboard must be set to predictive text mode, or what's called autocomplete mode. Just type a few characters."
  6. Click save when the system's predictive text is active.

@charles-liang Expensify/App#40799 issue arrises specifically when single character is the input. Can you please update your Test Steps and ScreenRecording to reflect that.

@charles-liang
Copy link
Author

@sobitneupane I have already updated the test video to include the content what requested.

@BartoszGrajdek
Copy link
Collaborator

Sorry, I was on sick leave last week. I'll take a look today 👀

@sobitneupane
Copy link

sobitneupane commented May 21, 2024

@charles-liang It seems there might have been an issue while resolving the conflict. Could you please take another look at the code and address the problem? Thanks!

You probably had merge conflict with this PR.

@sobitneupane
Copy link

@charles-liang I tried to resolve the conflict and test it in my end. But it doesn't solve the issue. In fact it introduces a new problem: when I go to any chat in mWeb/chrome and start typing, no letters are displayed on the Composer.

@charles-liang
Copy link
Author

@sobitneupane i merge to latest main branch and retest it.

Copy link

@sobitneupane sobitneupane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@charles-liang how did you test the PR? I might be missing something in my testing. I can still reproduce the issue.

updateTextColor(divRef.current, changedText);
const nativeEvent = e.nativeEvent as MarkdownNativeEvent;
if (compositionRef.current && (nativeEvent.inputType !== 'insertCompositionText' || nativeEvent.data !== '*')) {
updateTextColor(divRef.current, e.target.innerText);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have removed the change introduced by this PR.

Suggested change
updateTextColor(divRef.current, e.target.innerText);
updateTextColor(divRef.current, changedText);

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sobitneupane i copy the builded into App/node_modules/@expensify/react-native-live-markdown/lib/commonjs/MarkdownTextInput.web.jsMarkdownTextInput.web.js.

and the test step

Manual Tests

On Android mWeb

  1. Navigate to staging.new.expensify.com
  2. Click on FAB > Submit expense > Manual
  3. Input an amount
  4. Select a user
  5. Click on "Description"
    "The system keyboard must be set to predictive text mode, or what's called autocomplete mode. Just type a few characters."
  6. Click save when the system's predictive text is active.

@sobitneupane
Copy link

@charles-liang I replaced the react-native-live-markdown in node-modules with the one from the PR (after yarn prepare), but I can still reproduce the issue.

vidma_recorder_edited_24052024_144317.mp4

@@ -337,14 +338,14 @@ const MarkdownTextInput = React.forwardRef<TextInput, MarkdownTextInputProps>(
}
const changedText = e.target.innerText;

if (compositionRef.current) {
const nativeEvent = e.nativeEvent as MarkdownNativeEvent;
if (compositionRef.current && (nativeEvent.inputType !== 'insertCompositionText' || nativeEvent.data !== '*')) {
Copy link

@sobitneupane sobitneupane May 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we return early if inputType is insertCompositionText?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have reviewed my proposal again, and I apologize for modifying the wrong code while handling conflicting situations.

The condition here is that it only early returns if the composite and type are insertCompositionText, and it is not ** to bold.

@BartoszGrajdek
Copy link
Collaborator

Hi! Not sure if you want me to review the PR yet since it's still being worked on. Let me know what's the status of it 👀 @sobitneupane

@sobitneupane
Copy link

@BartoszGrajdek I will review it in my end first and will let you know .

@tomekzaw
Copy link
Collaborator

We think this might be already fixed in E/App so we're waiting for re-tests of the app.

@sobitneupane
Copy link

We can close this PR. The issue linked with the PR is no longer reproducible.

@tomekzaw tomekzaw closed this Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants