Skip to content

Commit

Permalink
Elements-1699-BACKPORT: Make comments edit and cancel edit button usa…
Browse files Browse the repository at this point in the history
…ble with keyboard only
  • Loading branch information
shadwal-sinha committed Dec 26, 2023
1 parent 9b38235 commit bf960a1
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions ui/nuxeo-document-comments/nuxeo-document-comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,13 +239,17 @@ import '../nuxeo-button-styles.js';
class="main-option opaque"
icon="check"
on-tap="_submitComment"
on-keydown="_submitOnEnter"
tabindex="0"
></iron-icon>
<nuxeo-tooltip for="submit">[[i18n('comments.submit.tooltip')]]</nuxeo-tooltip>
<iron-icon
name="clear"
class="main-option opaque"
icon="clear"
on-tap="_clearInput"
on-keydown="_cancelOnEnter"
tabindex="0"
></iron-icon>
</template>
</dom-if>
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit bf960a1

Please sign in to comment.