message: Fix `keyboard-navigation` issues
diff: @@ -4,6 +4,13 @@ import * as pageDetect from 'github-url-detection';
  import features from '.';
  import {isEditable} from '../helpers/dom-utils';
  +const isCommentGroupMinimized = (comment: HTMLElement): boolean =>
  + select.exists('.minimized-comment:not(.d-none)', comment) ||
  + Boolean(comment.closest(`
  + .js-resolvable-thread-contents.d-none,
  + .js-resolvable-timeline-thread-container:not([open])
  + `));
  +
  function runShortcuts(event: KeyboardEvent): void {
  if (isEditable(event.target)) {
  return;
  @@ -14,8 +21,19 @@ function runShortcuts(event: KeyboardEvent): void {
  if (['j', 'k'].includes(event.key)) {
  event.preventDefault();
  - const items = select.all('.js-targetable-element:not([id^="pullrequestreview"]')
  - .filter(comment => !comment.querySelector('.minimized-comment:not(.d-none)'));
  + const items = select
  + .all([
  + // Files in diffs
  + '.js-targetable-element[id^="diff-"]',
  + // Comments (to be `.filter()`ed)
  + '.js-minimizable-comment-group'
  + ])
  + .filter(element =>
  + element.classList.contains('js-minimizable-comment-group') ?
  + !isCommentGroupMinimized(element) :
  + true
  + );
  +
  // `j` goes to the next comment, `k` goes back a comment
  const direction = event.key === 'j' ? 1 : -1;
  