From 520c2be5feb5f62e136b27b7a877eeda281d33a3 Mon Sep 17 00:00:00 2001 From: Tomi Virkki Date: Mon, 8 Jun 2020 14:34:03 +0300 Subject: [PATCH] fix: Avoid sub-pixel rendering causing too narrow auto-width columns (#1750) (#1751) --- src/vaadin-grid.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/vaadin-grid.html b/src/vaadin-grid.html index c9060a6ce..3412212e1 100644 --- a/src/vaadin-grid.html +++ b/src/vaadin-grid.html @@ -463,7 +463,9 @@ col._currentWidth = 0; // Note: _allCells only contains cells which are currently rendered in DOM col._allCells.forEach(c => { - col._currentWidth = Math.max(col._currentWidth, c.offsetWidth); + // Add 1px buffer to the offset width to avoid too narrow columns (sub-pixel rendering) + const cellWidth = c.offsetWidth + 1; + col._currentWidth = Math.max(col._currentWidth, cellWidth); }); }); // [write] Set column widths to fit widest measured content