Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add delete-review-comments-faster feature - #4099

Merged
fregante merged 25 commits into
refined-github:mainfrom
cheap-glitch:add-delete-review-comments-faster
Apr 26, 2021
Merged

Add delete-review-comments-faster feature#4099
fregante merged 25 commits into
refined-github:mainfrom
cheap-glitch:add-delete-review-comments-faster

Conversation

@cheap-glitch

@cheap-glitch cheap-glitch commented Mar 14, 2021

Copy link
Copy Markdown
Contributor

Closes #3605

Test URLs

  • this PR's discussion thread
  • this PR's files

Screenshot

image

import delegate from 'delegate-it';
import {observe} from 'selector-observer';
import * as pageDetect from 'github-url-detection';

@cheap-glitch cheap-glitch Mar 14, 2021

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is a review comment for testing.

@cheap-glitch cheap-glitch changed the title Add quick-review-comment-deletion feature Add delete-review-comments-faster feature Mar 14, 2021
Comment thread source/features/delete-review-comments-faster.tsx Outdated

@fregante fregante left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In the PR comment body, you can always attach a simple screenshot/gif, it doesn't have to be final, it's just so the current style can be reviewed without having to check out the PR — unless you're still actively working on the PR right now and it's not working.

Comment thread source/features/delete-review-comments-faster.tsx Outdated
Comment thread source/features/delete-review-comments-faster.tsx Outdated
Comment thread source/features/delete-review-comments-faster.tsx Outdated
Comment thread source/features/delete-review-comments-faster.tsx Outdated
@fregante

fregante commented Mar 17, 2021

Copy link
Copy Markdown
Member

image

Oof, I'm not so sure about this anymore. If we add a delete button, we definitely shouldn't move the cancel button to the left side.

Also we should probably add an X icon to make it differentiate it further from Cancel

@cheap-glitch

cheap-glitch commented Mar 17, 2021

Copy link
Copy Markdown
Contributor Author

Oof, I'm not so sure about this anymore. If we add a delete button, we definitely shouldn't move the cancel button to the left side.

Yeah, I agree that the UX is rather perilous 😓.

We could move the "Delete" button all the way to the left of the "Cancel" button, and make it smaller (maybe even reduce it to something like a trash icon) so it's harder to click by mistake.

ping: @fregante thoughts?

@fregante

fregante commented Mar 18, 2021

Copy link
Copy Markdown
Member

In what situations do we see a Cancel button? I think:

  • Editing a comment
  • Editing a review comment
  • Sending a new review comment (this already appears on the right side)

"Cancel" should appear in the same place everywhere, so probably:

_________________________________________________
| Editing a review comment                      |
|                                               |
|                                               |
|_______________________________________________|
  [Delete]            [Cancel] [Update comment]
_________________________________________________
| Editing a regular comment                     |
|                                               |
|                                               |
|_______________________________________________|
                      [Cancel] [Update comment]
_________________________________________________
| Sending a new review comment                  |
|                                               |
|                                               |
|_______________________________________________|
           [Cancel] [Add single comment] [Start review]

This partially undoes safer-destructive-actions

We also need to consider the "Close" and "Close with comment" buttons that should remain on the left.

_________________________________________________
| Sending a new regular comment                 |
|                                               |
|                                               |
|_______________________________________________|
  [Close with comment]                [Comment]

@cheap-glitch

Copy link
Copy Markdown
Contributor Author

I'm -0 on moving the cancel buttons, I think it's better if they stay on the left. Maybe I'm missing something but I don't think we should change every single layout to accommodate for one specific case.

Just to be clear, what I'm proposing is:

_________________________________________________
| Editing a review comment                      |
|                                               |
|                                               |
|_______________________________________________|
  [Delete][Cancel]             [Update comment]

This is in keeping with safer-destructive-actions since the most destructive action ends up all the way to the left.

@FloEdelmann

FloEdelmann commented Mar 29, 2021

Copy link
Copy Markdown
Member

What about making the "Delete" button an icon-only button (with the trash icon)?

_________________________________________________
| Editing a review comment                      |
|                                               |
|_______________________________________________|
[Cancel]                    [🗑] [Update comment]

Then clicking "Delete" accidentally is more difficult, and it can't be confused (via position or appearance) with the "Cancel" button.

@cheap-glitch

This comment has been minimized.

@FloEdelmann

Copy link
Copy Markdown
Member

When you click "cancel", you are expecting a confirm dialog, so you'll accept it without reading.

When the delete button and the cancel button are close to each other, it's easier to confuse them, which might lead to some accidentally deleted comments instead of cancelled edits.

@cheap-glitch

This comment has been minimized.

@FloEdelmann

Copy link
Copy Markdown
Member

Afaik there is no confirm dialog when you cancel editing a comment.

There is, but only after actually changing the textarea content.

It's all just speculation though, I'm not a UX designer and I don't have any real-world data 😃

Same for me 😅

@fregante

fregante commented Apr 3, 2021

Copy link
Copy Markdown
Member

You're both right and I can't think of a position that:

  • doesn't move the cancel button: people expect to find it there and end up clicking on delete
  • doesn't appear next to Update comment: it goes against the spirit of safer-destructive-actions

Maybe I have 2 more suggestions to add to the mix:

  • center it between cancel and update, via flex or similar, red text
  • delete the comment by emptying the field: Clicking "update" after emptying the field doesn't make any changes. It could offer to delete the comment in a generic but somewhat obvious way but this is:
    • not discoverable
    • requires at least 2 more commands: cmd+a + delete
    • probably requires changing the Update button to a Delete button, which is a bit of code

@fregante

fregante commented Apr 3, 2021

Copy link
Copy Markdown
Member

Also this doesn't necessarily need to be restricted to PR comments, however it's probably not as useful outside reviews (which is when one might decide to delete/move comments before submitting a review)

Comment thread source/features/delete-review-comments-faster.tsx
@cheap-glitch

cheap-glitch commented Apr 7, 2021

Copy link
Copy Markdown
Contributor Author

Delete button on the left (but not where "Cancel" is expected to be), reduced to an icon to minimize misclicks:
Screenshot_2021-04-07 Add delete-review-comments-faster feature by cheap-glitch · Pull Request #4099 · sindresorhus refin

Delete button in the center, as suggested by @fregante:
Screenshot_2021-04-07 Add delete-review-comments-faster feature by cheap-glitch · Pull Request #4099 · sindresorhus refin (1)

I think the first option looks better, but the second one might be the best in terms of UX. @yakov116 @FloEdelmann thoughts?

@yakov116

yakov116 commented Apr 7, 2021

Copy link
Copy Markdown
Member

Option 2

@fregante

Copy link
Copy Markdown
Member

Sorry for the change again, but I think this looks better, which is important since this appears on a lot of forms

Screenshot_2021-04-07 Add delete-review-comments-faster feature by cheap-glitch · Pull Request #4099 · sindresorhus refin

Comment thread source/features/delete-review-comments-faster.tsx
Co-authored-by: yakov116 <[email protected]>
Comment thread source/features/delete-review-comments-faster.tsx
@fregante fregante assigned fregante and unassigned fregante Apr 21, 2021
@fregante

Copy link
Copy Markdown
Member

I finally tested this. The delay introduced by the context menu’s delayed loading makes it look like it's not working for a bit:

gif

You can see that I can click multiple times before it starts loading (at my first trial I thought it wasn't loading at all because it took a second or more)

I think we have 2 options:

  • add a loading icon in the button (😬)
  • use the API to delete the button and then manually update the UI

The first one is still slow and still bound to errors (we should display an alert if we catch an error) and the second one, while easy on the surface, requires a way to correctly update the whole review UI.

It's unfortunate that we need that exact "delete" form to perform the action in the DOM. I tried using a different "authenticity token" and GitHub responded with a 422.

@fregante
fregante marked this pull request as draft April 21, 2021 07:13
@cheap-glitch

Copy link
Copy Markdown
Contributor Author

The delay introduced by the context menu’s delayed loading makes it look like it's not working for a bit

Since this only happens when using the edit-comments-faster button that bypasses the dropdown, how about preloading the dropdown when that button is clicked?

@fregante

Copy link
Copy Markdown
Member

Good compromise

@fregante fregante left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Works great! There's only one last minor change I'd like to see

Comment thread source/github-events/on-fragment-load.ts Outdated
@fregante
fregante marked this pull request as ready for review April 25, 2021 09:28
Comment thread source/features/delete-review-comments-faster.tsx Outdated
Comment thread source/refined-github.ts Outdated
@fregante
fregante merged commit 6cd8010 into refined-github:main Apr 26, 2021
@cheap-glitch
cheap-glitch deleted the add-delete-review-comments-faster branch April 26, 2021 16:32
@yakov116

Copy link
Copy Markdown
Member

🎉

@bl-ue

bl-ue commented Apr 30, 2021

Copy link
Copy Markdown

When is this feature going to be released? I often want to delete un-sent review comments but it's rather tedious 🤔

@yakov116

Copy link
Copy Markdown
Member

Tomorrow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

Delete review comments while trying to edit them

5 participants