Skip to content

Commit

Permalink
Stopped propagation of typing events to prevent triggering hotkeys.
Browse files Browse the repository at this point in the history
  • Loading branch information
fkurmannucsc authored Jul 3, 2024
1 parent 982636b commit 8040101
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ function initVideo(info) {
</div>
</div>
`;

removeHotkeysOnText();
}

function toggleSelection() {
Expand Down Expand Up @@ -257,6 +259,8 @@ function addScreenshot(screenshot) {
`;

document.querySelector('.screenshot-area').insertAdjacentHTML('afterbegin', html);

removeHotkeysOnText();
}

// Flip a screenshot by adding it the the canvas flipped horizontally or vertically.
Expand Down Expand Up @@ -473,6 +477,14 @@ function initializeHotkeys() {
save();
}
});

removeHotkeysOnText();
}

function removeHotkeysOnText() {
document.querySelectorAll('input[type="text"]').forEach((input) => {
input.setAttribute('onkeydown', 'event.stopPropagation()');
});
}

function main() {
Expand Down

0 comments on commit 8040101

Please sign in to comment.