From 89db2d23705376e04e4cd2ccff2eb81c15934cd9 Mon Sep 17 00:00:00 2001 From: Shadwal Sinha Date: Tue, 26 Dec 2023 15:01:52 +0530 Subject: [PATCH] Elements-1699: 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);