diff --git a/services/web/app/views/project/editor/review-panel.pug b/services/web/app/views/project/editor/review-panel.pug index aa9cff0228..93f9cc9cd6 100644 --- a/services/web/app/views/project/editor/review-panel.pug +++ b/services/web/app/views/project/editor/review-panel.pug @@ -480,6 +480,7 @@ script(type='text/ng-template', id='addCommentEntryTemplate') expandable-text-area ng-model="state.content" ng-keypress="handleCommentKeyPress($event);" + ng-keydown="handleCommentKeyDown($event);" placeholder=translate("add_your_comment_here") focus-on="comment:new:open" ) diff --git a/services/web/frontend/js/ide/review-panel/directives/addCommentEntry.js b/services/web/frontend/js/ide/review-panel/directives/addCommentEntry.js index e844629bfe..efae4696df 100644 --- a/services/web/frontend/js/ide/review-panel/directives/addCommentEntry.js +++ b/services/web/frontend/js/ide/review-panel/directives/addCommentEntry.js @@ -31,6 +31,16 @@ App.directive('addCommentEntry', () => ({ scope.onCancel() } + const ignoreKeysInTextAreas = ['PageDown', 'PageUp'] + + scope.handleCommentKeyDown = function (ev) { + if (ignoreKeysInTextAreas.includes(ev.key)) { + if (ev.target.closest('textarea')) { + ev.preventDefault() + } + } + } + scope.handleCommentKeyPress = function (ev) { if (ev.keyCode === 13 && !ev.shiftKey && !ev.ctrlKey && !ev.metaKey) { ev.preventDefault()