Skip to content

Conversation

@yakov116
Copy link
Member

@yakov116 yakov116 commented Jun 17, 2020

  1. LINKED ISSUES:
    Closes Navigating Issues/PRs with keyboard shortcuts #1270

  2. TEST URLS:
    Navigating Issues/PRs with keyboard shortcuts #1270

  3. SCREENSHOT:
    None

Adds the following shortcuts:

	j: 'Move up a comment',
	k: 'Move down a comment',
	e: 'Edit the focused comment',
	d: 'Delete the focused comment'

@yakov116

This comment has been minimized.

@yakov116

This comment has been minimized.

@yakov116 yakov116 requested a review from fregante June 18, 2020 02:40
@yakov116
Copy link
Member Author

yakov116 commented Jun 18, 2020

I tested it looks like its working. Will work on in tomorrow morning some more.

Thanks for reviewing!

Copy link
Member

@fregante fregante left a comment

Choose a reason for hiding this comment

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

There's 4-part suggestion to split the shortcutClass.has(event.key) check in 2 pieces (since you're already checking these keys specifically: ['j', 'k'].includes(event.key))

yakov116 and others added 3 commits June 18, 2020 07:58
@yakov116

This comment has been minimized.

@yakov116

This comment has been minimized.

Copy link
Member

@fregante fregante left a comment

Choose a reason for hiding this comment

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

Here's a requested change, but reviews can't be minimized.

@yakov116 yakov116 requested a review from fregante June 18, 2020 20:44
@yakov116
Copy link
Member Author

yakov116 commented Jun 18, 2020

@fregante I spent about 2 hours trying to figure out another solution.

I need the popup to open, for review comments editing and the hide to work.

Maybe you can help me.

Side note: I think the feature is fully functional and working well

Comment on lines 22 to 23
const items = select.all('.js-targetable-element')
.filter(comment => !comment.querySelector('.minimized-comment:not(.d-none)'));
Copy link
Member Author

Choose a reason for hiding this comment

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

This filter does not work correctly it needs to check also for '.js-minimizable-comment-group'.
Can I do the following?

Suggested change
const items = select.all('.js-targetable-element')
.filter(comment => !comment.querySelector('.minimized-comment:not(.d-none)'));
const itemsSelectors = pageDetect.isPRFiles ? '.js-targetable-element' : '.js-minimizable-comment-group'
const items = select.all(itemsSelectors)
.filter(comment => !comment.querySelector('.minimized-comment:not(.d-none)'));

Copy link
Member

Choose a reason for hiding this comment

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

If by "does not work correctly" you mean "it highlights reviews but they don't have a highlight outline", then the solution could be:

.js-targetable-element:not([id^="pullrequestreview"])

This comment was marked as abuse.

Copy link
Member

@fregante fregante Jul 2, 2020

Choose a reason for hiding this comment

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

That's fine. Minimized comments are still comments. A future shortcut could open them

Copy link
Member

Choose a reason for hiding this comment

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

.js-targetable-element:not([id^="pullrequestreview"])

Let's also use this

Copy link
Member

@fregante fregante left a comment

Choose a reason for hiding this comment

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

Sorry that this PR is taking so long, but I want to get it right 😅

Honestly I'd also drop the e/d shortcuts for now. I feel that:

  • file/comment navigation is already super useful on its own
  • on their own, delete/edit aren't actions one needs to take that frequently.

We could discuss this separately and merge this before tomorrow's release if those shortcuts are temporarily dropped.


The following suggestions can be applied at once to remove those 2 shortcuts

readme.md Outdated
- [](# "minimize-upload-bar") [Reduces the upload bar to a small button.](https://user-images.githubusercontent.com/55841/59802383-3d994180-92e9-11e9-835d-60de67611c30.png)
- [](# "clean-rich-text-editor") [Hides unnecessary comment field tooltips and toolbar items](https://user-images.githubusercontent.com/1402241/53629083-a4fe8900-3c47-11e9-8211-bfe2d254ffcb.png) (each one has a keyboard shortcut.)
- [](# "monospace-textareas") Use a monospace font for all textareas.
- [](# "keyboard-navigation") Adds shortcuts to comments: <kbd>j</kbd> focuses the comment below; <kbd>k</kbd> focuses the comment above; <kbd>e</kbd> edits the focused comment; <kbd>d</kbd> deletes the focused comment.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- [](# "keyboard-navigation") Adds shortcuts to comments: <kbd>j</kbd> focuses the comment below; <kbd>k</kbd> focuses the comment above; <kbd>e</kbd> edits the focused comment; <kbd>d</kbd> deletes the focused comment.
- [](# "keyboard-navigation") Adds shortcuts to comments and PR files: <kbd>j</kbd> focuses the comment below..

Co-authored-by: Fregante <opensource@bfred.it>
@yakov116
Copy link
Member Author

yakov116 commented Jul 1, 2020

Sorry that this PR is taking so long, but I want to get it right 😅

Thanks for working with me!!

Applied will test later tonight

@yakov116
Copy link
Member Author

yakov116 commented Jul 2, 2020

Tested. Its good with me except for #3242 (comment)

Copy link
Member

@fregante fregante left a comment

Choose a reason for hiding this comment

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

I haven't re-tested it, but it looks good

@yakov116
Copy link
Member Author

yakov116 commented Jul 3, 2020

FTR this is what I am talking about. That it randomly opens minimized reviews when using only the .js-targetable-element selector.
Video_2020-07-03_094716

But lets deal with this issue another time.

Co-authored-by: Fregante <opensource@bfred.it>
@fregante fregante merged commit b5c240b into refined-github:master Jul 6, 2020
@fregante
Copy link
Member

fregante commented Jul 6, 2020

You made it! I opened a new issue for the remaining concerns: #3319

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.

Navigating Issues/PRs with keyboard shortcuts

4 participants