Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/raven.js
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ Raven.prototype = {
// only consider keypress events on actual input elements
// this will disregard keypresses targeting body (e.g. tabbing
// through elements, hotkeys, etc)
if (!tagName || tagName !== 'INPUT' && tagName !== 'TEXTAREA')
if (!tagName || tagName !== 'INPUT' && tagName !== 'TEXTAREA' && !target.isContentEditable)
return;

// record first keypress in a series, but ignore subsequent
Expand Down
1 change: 1 addition & 0 deletions test/integration/frame.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
<!-- test element for breadcrumbs -->
<form id="foo-form">
<input name="foo" placeholder="lol"/>
<div class="contenteditable" contenteditable="true"></div>
</form>

<div class="c">
Expand Down
33 changes: 33 additions & 0 deletions test/integration/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,39 @@ describe('integration', function () {
);
});

it('should record consecutive keypress events in a contenteditable into a single "input" breadcrumb', function (done) {
var iframe = this.iframe;

iframeExecute(iframe, done,
function () {
setTimeout(done);

// some browsers trigger onpopstate for load / reset breadcrumb state
Raven._breadcrumbs = [];

// keypress <input/> twice
var keypress1 = document.createEvent('KeyboardEvent');
keypress1.initKeyboardEvent("keypress", true, true, window, "b", 66, 0, "", false);

var keypress2 = document.createEvent('KeyboardEvent');
keypress2.initKeyboardEvent("keypress", true, true, window, "a", 65, 0, "", false);

var div = document.querySelector('[contenteditable]');
div.dispatchEvent(keypress1);
div.dispatchEvent(keypress2);
},
function () {
var Raven = iframe.contentWindow.Raven,
breadcrumbs = Raven._breadcrumbs;

assert.equal(breadcrumbs.length, 1);

assert.equal(breadcrumbs[0].category, 'ui.input');
assert.equal(breadcrumbs[0].message, 'body > form#foo-form > div.contenteditable');
}
);
});

it('should record history.[pushState|back] changes as navigation breadcrumbs', function (done) {
var iframe = this.iframe;

Expand Down