• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

MarkUsProject / Markus / 27065653175

06 Jun 2026 03:01PM UTC coverage: 90.291% (+0.09%) from 90.202%
27065653175

Pull #7989

github

web-flow
Merge 241303105 into 07b06ab1e
Pull Request #7989: Move criterion keyboard navigation into React components

1048 of 2237 branches covered (46.85%)

Branch coverage included in aggregate %.

52 of 55 new or added lines in 3 files covered. (94.55%)

1 existing line in 1 file now uncovered.

46253 of 50150 relevant lines covered (92.23%)

126.01 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

25.0
/app/javascript/Components/Result/keybinding.js
1
// Open the keyboard shortcuts help modal
2
import Mousetrap from "mousetrap";
3

4
// Allow navigation keybindings to fire even when a form input has focus.
5
// Mousetrap suppresses all bindings on inputs by default to avoid interfering
6
// with typing, but these combos don't produce characters so suppression is wrong.
7
// shift+n is intentionally excluded so it stays blocked while typing.
8
const _originalStopCallback = Mousetrap.stopCallback.bind(Mousetrap);
2✔
9
Mousetrap.stopCallback = function (e, element, combo) {
2✔
NEW
10
  const allowedOnInputs = [
×
11
    "shift+up",
12
    "shift+down",
13
    "shift+left",
14
    "shift+right",
15
    "ctrl+shift+right",
16
    "alt+enter",
17
  ];
NEW
18
  if (allowedOnInputs.includes(combo)) return false;
×
NEW
19
  return _originalStopCallback(e, element, combo);
×
20
};
21

22
export function bind_keybindings() {
23
  Mousetrap.bind("?", function () {
26✔
24
    modal_help.open();
×
25
  });
26

27
  function is_text_selected() {
28
    return "getSelection" in window && window.getSelection().type === "Range";
×
29
  }
30

31
  // Go to the previous submission with <
32
  Mousetrap.bind("shift+left", function () {
26✔
33
    // Don't override range selection keybindings
34
    if (!is_text_selected()) {
×
35
      $(".button.previous")[0].click();
×
36
    }
37
  });
38

39
  // Go to next submission with >
40
  Mousetrap.bind("shift+right", function () {
26✔
41
    if (!is_text_selected()) {
×
42
      $(".button.next")[0].click();
×
43
    }
44
  });
45

46
  // Go to a random incomplete submission with ctrl + shift + right
47
  Mousetrap.bind("ctrl+shift+right", function () {
26✔
48
    // Don't override range selection keybindings
49
    if (!is_text_selected()) {
×
50
      $(".button.random-incomplete-submission")[0].click();
×
51
    }
52
  });
53

54
  // Press shift+n for new annotation modal to appear
55
  Mousetrap.bind("shift+n", () => {
26✔
56
    if ($("#annotation_dialog:visible").length == 0) {
×
57
      resultComponent.current.newAnnotation();
×
58
      return false;
×
59
    }
60
  });
61

62
  // When alt+enter is pressed, toggle fullscreen mode
63
  Mousetrap.bind("alt+enter", () => {
26✔
64
    resultComponent.current.toggleFullscreen();
×
65
  });
66
}
67

68
export function unbind_all_keybindings() {
69
  Mousetrap.reset();
27✔
70
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc