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

divio / django-cms / #30104

12 Nov 2025 07:43PM UTC coverage: 90.527% (-0.005%) from 90.532%
#30104

push

travis-ci

web-flow
Merge 3b322ced6 into c38b75715

1306 of 2044 branches covered (63.89%)

336 of 363 new or added lines in 21 files covered. (92.56%)

458 existing lines in 7 files now uncovered.

9145 of 10102 relevant lines covered (90.53%)

11.2 hits per line

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

35.71
/cms/static/cms/js/modules/keyboard.js
1
import keyboard from 'keyboardjs';
2

3
/**
4
 * @function override
5
 * @private
6
 * @param {Function} originalFunction to override
7
 * @param {Function} functionBuilder function that accepts a function to wrap
8
 * @returns {Function}
9
 */
10
function override(originalFunction, functionBuilder) {
11
    var newFn = functionBuilder(originalFunction);
1✔
12

13
    newFn.prototype = originalFunction.prototype;
1✔
14
    return newFn;
1✔
15
}
16

17
/**
18
 * Check if the currently focused element is an input field
19
 * @returns {boolean}
20
 */
21
function isInputFocused() {
NEW
22
    const activeElement = document.activeElement;
×
23

NEW
24
    if (!activeElement) {
×
NEW
25
        return false;
×
26
    }
27

NEW
28
    const tagName = activeElement.tagName.toLowerCase();
×
NEW
29
    const isContentEditable = activeElement.contentEditable === 'true';
×
30

NEW
31
    return tagName === 'input' ||
×
32
           tagName === 'textarea' ||
33
           tagName === 'select' ||
34
           isContentEditable;
35
}
36

37
/**
38
 * Override keyboardjs methods to disallow running callbacks
39
 * if input is focused
40
 */
41
keyboard._applyBindings = override(keyboard._applyBindings, function(originalBind) {
1✔
42
    return function(event) {
1✔
NEW
43
        if (isInputFocused()) {
×
44
            return true;
×
45
        }
46

47
        originalBind.call(this, event);
×
48
    };
49
});
50

51
export default keyboard;
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

© 2025 Coveralls, Inc