@vaadin/vaadin-grid 5.9.4 → 5.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/vaadin-grid.js +14 -5
package/package.json
CHANGED
package/src/vaadin-grid.js
CHANGED
|
@@ -325,7 +325,7 @@ class GridElement extends
|
|
|
325
325
|
}
|
|
326
326
|
|
|
327
327
|
static get version() {
|
|
328
|
-
return '5.9.
|
|
328
|
+
return '5.9.5';
|
|
329
329
|
}
|
|
330
330
|
|
|
331
331
|
static get observers() {
|
|
@@ -336,6 +336,12 @@ class GridElement extends
|
|
|
336
336
|
|
|
337
337
|
static get properties() {
|
|
338
338
|
return {
|
|
339
|
+
/** @private */
|
|
340
|
+
_chrome: {
|
|
341
|
+
type: Boolean,
|
|
342
|
+
value: /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor)
|
|
343
|
+
},
|
|
344
|
+
|
|
339
345
|
/** @private */
|
|
340
346
|
_safari: {
|
|
341
347
|
type: Boolean,
|
|
@@ -601,13 +607,16 @@ class GridElement extends
|
|
|
601
607
|
// focusable slot wrapper, that is why cells are not focused with
|
|
602
608
|
// mousedown. Workaround: listen for mousedown and focus manually.
|
|
603
609
|
cellContent.addEventListener('mousedown', () => {
|
|
604
|
-
if (
|
|
610
|
+
if (this._chrome) {
|
|
605
611
|
// Chrome bug: focusing before mouseup prevents text selection, see http://crbug.com/771903
|
|
606
|
-
const mouseUpListener = () => {
|
|
607
|
-
|
|
612
|
+
const mouseUpListener = (event) => {
|
|
613
|
+
// If focus is on element within the cell content — respect it, do not change
|
|
614
|
+
const contentContainsFocusedElement = cellContent.contains(this.getRootNode().activeElement);
|
|
615
|
+
// Only focus if mouse is released on cell content itself
|
|
616
|
+
const mouseUpWithinCell = event.composedPath().indexOf(cellContent) >= 0;
|
|
617
|
+
if (!contentContainsFocusedElement && mouseUpWithinCell) {
|
|
608
618
|
cell.focus();
|
|
609
619
|
}
|
|
610
|
-
// If focus is in the cell content — respect it, do not change.
|
|
611
620
|
document.removeEventListener('mouseup', mouseUpListener, true);
|
|
612
621
|
};
|
|
613
622
|
document.addEventListener('mouseup', mouseUpListener, true);
|