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

[IS-3218] Fixed cursor issue on edit comment box #3434

Merged

Conversation

aliabbasmalik8
Copy link
Contributor

@aliabbasmalik8 aliabbasmalik8 commented Jun 8, 2021

Details

Fixed Issues

Fixes #3218

Tests

QA Steps

  1. Navigate to a conversation in e.cash
  2. Hover over an owned message and click on the edit comment option in the menu
  3. or
  4. Tap up arrow key to edit the previous comment.
  5. See the cursor is set to the end of the message.

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Web

Screen.Recording.2021-06-08.at.9.13.46.AM.mov

Mobile Web

Desktop

Screen.Recording.2021-06-08.at.9.22.54.AM.mov

iOS

Screen.Recording.2021-06-08.at.9.09.10.AM.mov

Android

Screenrecorder-2021-06-08-21-25-56-100_0_COMPRESSED.mp4

@aliabbasmalik8 aliabbasmalik8 requested a review from a team as a code owner June 8, 2021 16:23
@MelvinBot MelvinBot requested review from Gonals and removed request for a team June 8, 2021 16:24
@Gonals Gonals merged commit 5ead572 into Expensify:main Jun 9, 2021
*
* @param {Event} e
*/
onSelectionChange(e) {
Copy link
Member

Choose a reason for hiding this comment

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

Overall looks good but this state change is unnecessary, I have already seen a drawback of this and I am migrating tis unnecessary state change. So my suggestion here would be to remove this as I mentioned over the issue.
cc: @Gonals

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@parasharrajat can you please let me know about the issue?
also, without state change, this issue will not be fixed.

Copy link
Member

Choose a reason for hiding this comment

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

This change is going against our old pattern of not making the Component controlled.

@OSBotify
Copy link
Contributor

OSBotify commented Jun 9, 2021

🚀 Deployed to staging in version: 1.0.65-6🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@kavimuru
Copy link

kavimuru commented Jun 9, 2021

mWeb - No cursor appears in edit comment box

Expected Result:

The cursor is set to the end of the message.

Actual Result:

No cursor appears in edit comment box

Actions Performed:

  1. Go to https://staging.expensify.cash

  2. Log in with applause account or gmail account

  3. Navigate to a conversation in e.cash

  4. Hover over an owned message and click on the edit comment option in the menu or tap up arrow key to edit the previous comment.

Platform:

iOS
mWeb ✔️
Android

Build:

1.0.66-0

Notes/Images/Video:

Bug5104994_Screen_Recording_20210609-103956_Chrome.mp4

@parasharrajat
Copy link
Member

@kavimuru It's being fixed #3441.

@kavimuru
Copy link

kavimuru commented Jun 9, 2021

App crashes when editing a comment

Expected Result:

User is able to edit and save the message successfully

Actual Result:

App keeps crashing when editing the message

Actions Performed:

  1. Launch the app and login
  2. Hover over an owned message and click on the edit comment option in the menu
  3. Start editing the message

Platform:

iOS
mWeb
Android ✔️

Build:

1.0.66-0

Notes/Images/Video:

Bug5105065_Screenshot_20210609-114353_One_UI_Home_1_

Bug5105065_20210609_112537_1_.mp4

expensify.txt

@isagoico isagoico added the DeployBlockerCash This issue or pull request should block deployment label Jun 9, 2021
@aliabbasmalik8 aliabbasmalik8 mentioned this pull request Jun 10, 2021
5 tasks
@Julesssss
Copy link
Contributor

Julesssss commented Jun 11, 2021

I believe this is no longer a deployBlocker, as this fix was merged and is on staging. Removing the label from here and the deploy issue.

@Julesssss Julesssss removed the DeployBlockerCash This issue or pull request should block deployment label Jun 11, 2021
@parasharrajat
Copy link
Member

@Julesssss just a heads up, I feel that the change we have done here has unnecessary state updates. We just want to set the cursor at the end of the text when we initiate the edit. So why we are re-rendering it on every input and setting the cursor, making it a controlled input. I believe we are following uncontrolled Textinput throughout the app. Even here you can see at this line
https://github.com/Expensify/Expensify.cash/blob/19ad75ea6b6905ce31f37b5e8251d98e23add5a1/src/pages/home/report/ReportActionItemMessageEdit.js#L65
&
https://github.com/Expensify/Expensify.cash/blob/19ad75ea6b6905ce31f37b5e8251d98e23add5a1/src/pages/home/report/ReportActionItemMessageEdit.js#L120.
we don't use value prop intentionally.

So I think I can submit a PR to replace the changes here with

    componentDidMount() {
        this.textInput.setNativeProps({selection: {start: this.props.draftMessage.length, end: this.props.draftMessage.length}});
    }

What are your thoughts?

@Julesssss
Copy link
Contributor

Thanks @parasharrajat, I need to review this on Monday but I think you make a good point. Have set a reminder to return to this.

@aliabbasmalik8
Copy link
Contributor Author

@Julesssss
We need a cursor position(selection) to add emojis in mid of the text. (there is an issue open to adding emojis functionality in the edit text compose box)

But for the 2nd point, we can use Direct Manipulation to avoid rerending also we can use this approach for the comment compose box.

Thanks

@OSBotify
Copy link
Contributor

🚀 Deployed to production in version: 1.0.68-4🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@parasharrajat
Copy link
Member

@Julesssss did you get chance to look at #3434 (comment) ?

@Julesssss
Copy link
Contributor

Ah, sorry I haven't yet. That makes sense to me though, good spot.

Would you like to raise an issue for this, and we can get it exported?

@parasharrajat
Copy link
Member

It's fine. Just a small change. Let me know PR will be up in no time.

@Julesssss
Copy link
Contributor

I'll try to add a small bonus to an existing contract instead. Thanks @parasharrajat


this.state = {
draft: this.props.draftMessage,
selection: {
Copy link
Member

Choose a reason for hiding this comment

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

Setting selection without focusing the input internally focuses the input on Safari which is then shifts to other elements causing bugs such as #15105

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants