accordproject / web-components

React Components for Accord Project
Apache License 2.0
120 stars 101 forks source link

fix(ui-contract-editor): Highlight read-only text clause template - i242 #251

Closed K-Kumar-01 closed 3 years ago

K-Kumar-01 commented 3 years ago

Signed-off-by: k-kumar-01 kushalkumargupta4@gmail.com

Closes #242

Users are able to highlight read-only text in the clause template.

Changes

Screenshots or Video

Screenshot from 2021-02-15 15-30-03

Author Checklist

jolanglinais commented 3 years ago

I don't think this is the implementation we'd want. If you click anywhere in the clause while readOnly is true, the entire clause is selected.

K-Kumar-01 commented 3 years ago

I don't think this is the implementation we'd want. If you click anywhere in the clause while readOnly is true, the entire clause is selected.

I had doubts whether we had to make it all selectable or some parts of it so I stuck to user-select:all I think user-select: none would work as it would make the content selectable which might be desired. @irmerk Would it be fine If some parts are highlightable instead if the entire clause in the readOnly state

jolanglinais commented 3 years ago

I think @Michael-Grover should take the lead on this one as far as UX goes.

K-Kumar-01 commented 3 years ago

@Michael-Grover Any updates on this?

dselman commented 3 years ago

@Michael-Grover Any updates on this?

@Michael-Grover is on vacation this week. The behaviour I think users will want is that they can select any of the text (in whole, or in part) of the document, including clauses - irrespective of whether the editor is in read/write or read-only mode.

As far as I can tell this seems to be the case, in Safari at least. I tested that copy/paste worked into a Google Doc and got quite good results. Paste back into the editor had some issues, but that should be covered under a separate issue.

K-Kumar-01 commented 3 years ago

@Michael-Grover is on vacation this week. The behaviour I think users will want is that they can select any of the text (in whole, or in part) of the document, including clauses - irrespective of whether the editor is in read/write or read-only mode.

@dselman Selecting any part of the text or whole can be implemented. I just had a doubt that if one can select any part of the text then they can edit the text in clause(when readOnly:false), if that is acceptable then I can implement this feature. There is no issue in readOnly knob regarding this.

Michael-Grover commented 3 years ago

Hi @K-Kumar-01 , thanks again for taking on this issue. I'm back from my vacation, so I can give some clarification about the expected behavior.

I think we should allow the user to choose what text they want to highlight, instead of forcing them to highlight the entire clause template. See the video for clarification.

https://www.loom.com/share/8c31e6837f8546b784f915bb26ede005

Here are some examples of a user choosing what they want to highlight in read-only text.

image image

K-Kumar-01 commented 3 years ago

Hi @K-Kumar-01 , thanks again for taking on this issue. I'm back from my vacation, so I can give some clarification about the expected behavior.

I think we should allow the user to choose what text they want to highlight, instead of forcing them to highlight the entire clause template. See the video for clarification.

https://www.loom.com/share/8c31e6837f8546b784f915bb26ede005

Here are some examples of a user choosing what they want to highlight in read-only text.

image image

@Michael-Grover Thanks for the clarification. I had a small doubt. If readOnly: false then should the text inside the clause template be editable? Rest for readOnly: true I think I got what I need to do.

K-Kumar-01 commented 3 years ago

Hi @K-Kumar-01 , thanks again for taking on this issue. I'm back from my vacation, so I can give some clarification about the expected behavior. I think we should allow the user to choose what text they want to highlight, instead of forcing them to highlight the entire clause template. See the video for clarification. https://www.loom.com/share/8c31e6837f8546b784f915bb26ede005 Here are some examples of a user choosing what they want to highlight in read-only text. image image

@Michael-Grover Thanks for the clarification. I had a small doubt. If readOnly: false then should the text inside the clause template be editable? Rest for readOnly: true I think I got what I need to do.

@Michael-Grover Any updates here?

Michael-Grover commented 3 years ago

@K-Kumar-01 The behavior of readOnly:false shouldn't change. This PR should only address allowing users to highlight text in a read only clause template.

K-Kumar-01 commented 3 years ago

@Michael-Grover I have updated my PR to highlight the text while retaining the original functionalities. Let me know if there is any change required.

dselman commented 3 years ago

@K-Kumar-01 Thanks, the functionality looks good to me. I think we should get an engineer's review before merging, like @jeromesimeon or @irmerk

Selection seems strange (Safari) and it seems different if you select forwards, or select backwards.

Forwards:

image

Backwards:

image

Michael-Grover commented 3 years ago

@dselman that's not in read only mode, right?

I'm seeing the same behavior in Google Chrome.

It looks like in this PR, the user can no longer highlight a combination of clause template text and normal text in editing mode. Users can do this in the current version of storybook here https://ap-web-components.netlify.app/?path=/story/contract-editor--contract-editor. We want to keep this functionality from the current version of the storybook, so that users can highlight a combination of clause template text and normal text.

https://www.loom.com/share/9ff9ecd27fbf409ea244a1918b1a612c

K-Kumar-01 commented 3 years ago

@K-Kumar-01 Thanks, the functionality looks good to me. I think we should get an engineer's review before merging, like @jeromesimeon or @irmerk

Selection seems strange (Safari) and it seems different if you select forwards, or select backwards.

Forwards:

image

Backwards:

image

@dselman @Michael-Grover I will try to find an alternative solution to fix this one

K-Kumar-01 commented 3 years ago

@dselman @Michael-Grover I have updated my PR. Also a video showing the working of my PR https://www.loom.com/share/738f544d7cd442bb9075f3003ccc26b4 Let me know if there are any changes required.

Michael-Grover commented 3 years ago

Looks great, thanks @K-Kumar-01 !