Skip to content

Commit ef609c8

Browse files
committed
revert scroll position changes
1 parent 7422bec commit ef609c8

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

packages/grid/src/vaadin-grid-drag-and-drop-mixin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ export const DragAndDropMixin = (superClass) =>
248248
let row = e.composedPath().find((node) => node.localName === 'tr');
249249

250250
// Update the horizontal scroll position property of the row being dragged over
251-
// this.__updateRowScrollPositionProperty(row);
251+
this.__updateRowScrollPositionProperty(row);
252252

253253
if (!this._flatSize || this.dropMode === DropMode.ON_GRID) {
254254
// The grid is empty or "on-grid" drop mode was used, always default to "empty"

packages/grid/src/vaadin-grid-scroll-mixin.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,26 @@ export const ScrollMixin = (superClass) =>
449449
}
450450
});
451451

452-
this.$.table.style.setProperty('--_grid-horizontal-scroll-position', `${this.__horizontalScrollPosition}px`);
452+
const focusedRow = this.shadowRoot.querySelector("[part~='row']:focus");
453+
if (focusedRow) {
454+
// Update the horizontal scroll position property of the focused row
455+
this.__updateRowScrollPositionProperty(focusedRow);
456+
}
457+
}
458+
459+
/**
460+
* Synchronizes the internal `--_grid-horizontal-scroll-position` CSS property
461+
* of the given row with the current horizontal scroll position of the grid.
462+
* @private
463+
*/
464+
__updateRowScrollPositionProperty(row) {
465+
if (row instanceof HTMLTableRowElement === false) {
466+
return;
467+
}
468+
const newValue = `${this.__horizontalScrollPosition}px`;
469+
if (row.style.getPropertyValue('--_grid-horizontal-scroll-position') !== newValue) {
470+
row.style.setProperty('--_grid-horizontal-scroll-position', newValue);
471+
}
453472
}
454473

455474
/** @private */

0 commit comments

Comments
 (0)