Skip to content

Commit

Permalink
WEBUI-1262: Make selection action in a nuxeo-data-grid card focusable
Browse files Browse the repository at this point in the history
  • Loading branch information
swarnadipa-dev committed Oct 4, 2023
1 parent 240f026 commit 41da423
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions elements/nuxeo-data-grid/nuxeo-document-grid-thumbnail.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ Polymer({
icon="icons:check"
title="[[_computeTitle(doc)]]"
on-tap="_onCheckBoxTap"
on-keydown="_onCheckBoxTap"
role="checkbox"
aria-checked="[[selected]]"
></paper-icon-button>
Expand Down Expand Up @@ -288,12 +289,15 @@ Polymer({
},

_onCheckBoxTap(e) {
this._toogleSelect(e);
// WEBUI-1262 : prevents checkbox selection during tab navigation
if (e.type === 'tap' || (e.key !== 'Tab' && e.key !== 'Shift')) {
this._toogleSelect(e);
}
},

_toogleSelect(e) {
this.selected = !this.selected;
this.fire('selected', { index: this.index, shiftKey: e.detail.sourceEvent.shiftKey });
this.fire('selected', { index: this.index, shiftKey: e.type === 'tap' ? e.detail.sourceEvent.shiftKey : false });
},

_selectedItemsChanged() {
Expand Down

0 comments on commit 41da423

Please sign in to comment.