From bf960a1ff37d882db7edfddff8efc991dc5d6c7b Mon Sep 17 00:00:00 2001 From: Shadwal Sinha Date: Tue, 26 Dec 2023 14:56:17 +0530 Subject: [PATCH] Elements-1699-BACKPORT: Make comments edit and cancel edit button usable with keyboard only --- .../nuxeo-document-comment.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ui/nuxeo-document-comments/nuxeo-document-comment.js b/ui/nuxeo-document-comments/nuxeo-document-comment.js index ea8052f0a..4a2c1018c 100644 --- a/ui/nuxeo-document-comments/nuxeo-document-comment.js +++ b/ui/nuxeo-document-comments/nuxeo-document-comment.js @@ -239,6 +239,8 @@ import '../nuxeo-button-styles.js'; class="main-option opaque" icon="check" on-tap="_submitComment" + on-keydown="_submitOnEnter" + tabindex="0" > [[i18n('comments.submit.tooltip')]] @@ -398,6 +402,18 @@ import '../nuxeo-button-styles.js'; }); } + _submitOnEnter(event) { + if (event.key === 'Enter') { + this._submitComment(); + } + } + + _cancelOnEnter(event) { + if (event.key === 'Enter') { + this._clearInput(); + } + } + _editComment() { this._setEditing(true); this.set('comment.text', this.$$('#view-comment').innerHTML);