From 2ac45aca44566a053096b2a78f2b14a4ad0e3065 Mon Sep 17 00:00:00 2001 From: Shadwal Sinha Date: Tue, 19 Dec 2023 20:40:01 +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..d9b360118 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(); + } + } + + _clearOnEnter(event) { + if (event.key === 'Enter') { + this._clearInput(); + } + } + _editComment() { this._setEditing(true); this.set('comment.text', this.$$('#view-comment').innerHTML);