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

MarkUsProject / Markus / 16926059701

13 Aug 2025 02:41AM UTC coverage: 91.872%. First build
16926059701

Pull #7636

github

web-flow
Merge af51766b4 into 369d65959
Pull Request #7636: Release 2.8.0

658 of 1421 branches covered (46.31%)

Branch coverage included in aggregate %.

484 of 558 new or added lines in 47 files covered. (86.74%)

42093 of 45112 relevant lines covered (93.31%)

118.33 hits per line

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

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

4
export function bind_keybindings() {
5
  Mousetrap.bind("?", function () {
31✔
NEW
6
    modal_help.open();
×
7
  });
8

9
  function is_text_selected() {
NEW
10
    return "getSelection" in window && window.getSelection().type === "Range";
×
11
  }
12

13
  // Go to the previous submission with <
14
  Mousetrap.bind("shift+left", function () {
31✔
15
    // Don't override range selection keybindings
NEW
16
    if (!is_text_selected()) {
×
NEW
17
      $(".button.previous")[0].click();
×
18
    }
19
  });
20

21
  // Go to next submission with >
22
  Mousetrap.bind("shift+right", function () {
31✔
NEW
23
    if (!is_text_selected()) {
×
NEW
24
      $(".button.next")[0].click();
×
25
    }
26
  });
27

28
  // Go to a random incomplete submission with ctrl + shift + right
29
  Mousetrap.bind("ctrl+shift+right", function () {
31✔
30
    // Don't override range selection keybindings
NEW
31
    if (!is_text_selected()) {
×
NEW
32
      $(".button.random-incomplete-submission")[0].click();
×
33
    }
34
  });
35

36
  // Go to the previous criterion with shift + up
37
  Mousetrap.bind("shift+up", function (e) {
31✔
NEW
38
    if (!is_text_selected()) {
×
NEW
39
      e.preventDefault();
×
NEW
40
      prevCriterion();
×
NEW
41
      return false;
×
42
    }
43
  });
44

45
  // Go to the next criterion with shift + down
46
  Mousetrap.bind("shift+down", function (e) {
31✔
NEW
47
    if (!is_text_selected()) {
×
NEW
48
      e.preventDefault();
×
NEW
49
      nextCriterion();
×
NEW
50
      return false;
×
51
    }
52
  });
53

54
  // When on rubric criterion, use the arrow keys to hover over the next rubric
55
  Mousetrap.bind("up", function (e) {
31✔
NEW
56
    let $current_criteria = $(".active-criterion");
×
NEW
57
    if (
×
58
      $current_criteria.length &&
×
59
      $current_criteria.hasClass("rubric_criterion") &&
60
      !$current_criteria.hasClass("unassigned")
61
    ) {
NEW
62
      e.preventDefault();
×
NEW
63
      let $selected = $(".active-rubric");
×
NEW
64
      if ($selected.length) {
×
NEW
65
        let $next = $selected.parent().prev();
×
NEW
66
        if (!$next.length) {
×
67
          // if no next element exists, loop back to the last of the list
NEW
68
          $next = $selected.parent().siblings().last();
×
69
        }
NEW
70
        $selected.removeClass("active-rubric");
×
NEW
71
        $next.children().addClass("active-rubric");
×
72
      }
NEW
73
      return false;
×
74
    }
75
  });
76

77
  // When on rubric criteria, use the arrow keys to hover over the next rubric
78
  Mousetrap.bind("down", function (e) {
31✔
NEW
79
    let $current_criteria = $(".active-criterion");
×
NEW
80
    if (
×
81
      $current_criteria.length &&
×
82
      $current_criteria.hasClass("rubric_criterion") &&
83
      !$current_criteria.hasClass("unassigned")
84
    ) {
NEW
85
      e.preventDefault();
×
NEW
86
      let $selected = $(".active-rubric");
×
NEW
87
      if ($selected.length) {
×
NEW
88
        let $next = $selected.parent().next();
×
NEW
89
        if (!$next.length) {
×
90
          // if no next element exists, loop back to the front of the list
NEW
91
          $next = $selected.parent().siblings().first();
×
92
        }
NEW
93
        $selected.removeClass("active-rubric");
×
NEW
94
        $next.children().addClass("active-rubric");
×
95
      }
NEW
96
      return false;
×
97
    }
98
  });
99

100
  // When enter is pressed, and there is an active rubric selected, trigger select and collapse
101
  Mousetrap.bind("enter", function (e) {
31✔
NEW
102
    if ($(".active-rubric").length) {
×
NEW
103
      e.preventDefault();
×
NEW
104
      $(".active-rubric")[0].click();
×
105
    }
106
  });
107

108
  // Press shift+n for new annotation modal to appear
109
  Mousetrap.bind("shift+n", () => {
31✔
NEW
110
    if ($("#annotation_dialog:visible").length == 0) {
×
NEW
111
      resultComponent.current.newAnnotation();
×
NEW
112
      return false;
×
113
    }
114
  });
115

116
  // When alt+enter is pressed, toggle fullscreen mode
117
  Mousetrap.bind("alt+enter", () => {
31✔
NEW
118
    resultComponent.current.toggleFullscreen();
×
119
  });
120
}
121

122
export function unbind_all_keybindings() {
123
  Mousetrap.reset();
32✔
124
}
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