web-components icon indicating copy to clipboard operation
web-components copied to clipboard

[Grid + Tree-Grid] Content of Grid and Tree-Grid is visible in the header when using Safari

Open F0rce opened this issue 3 years ago • 6 comments

Description

When scrolling the content of a Grid or a Tree-Grid in Safari the content is visible in the header (as there is a pixel space between the border and the header itself).

Expected outcome

The content should not be visible in the header.

Minimal reproducible example

https://vaadin.com/docs/latest/components/grid

https://vaadin.com/docs/latest/components/tree-grid

Steps to reproduce

  1. Open Safari
  2. Open the given documentation pages
  3. Scroll up and down and focus on the top of the grid / tree-grid

https://user-images.githubusercontent.com/60381251/185049296-6e849b13-c950-4609-b46c-0e4098612fe5.mov

https://user-images.githubusercontent.com/60381251/185049312-9216224e-e6b4-42d1-a963-986753cd1f82.mov

Environment

Vaadin version(s): 23.1.6 OS: macOS Monterey Version 12.5 (21G72) Browser: Safari Version 15.6 (17613.3.9.1.5)

Browsers

Safari

F0rce avatar Aug 17 '22 06:08 F0rce

The same applies to Safari on the latest iPhone / iOS

knoobie avatar Aug 17 '22 07:08 knoobie

This happens only on high DPI (aka “retina”) screens. It’s not an issue on displays with less pixels, like my ancient Thunderbolt display. I assume it’s related to the subpixel display grid, how pixels are aligned to it, and especially elements that are on their own layer (transformed or position sticky/fixed).

jouni avatar Aug 18 '22 08:08 jouni

Adding :host { contain: strict|paint|content; } looks like a potential fix.

jouni avatar Aug 18 '22 08:08 jouni

Is there a way to fix it on my end ? or do I have to wait unti a new version of the grids is availible ? Thanks a lot for the fast reply.

Just out of curiousity, couldn't this behaviour happen in other components aswell ?

F0rce avatar Aug 18 '22 08:08 F0rce

Create a vaadin-grid.css inside your theme's component folder and add the css provided by Jouni.

knoobie avatar Aug 18 '22 09:08 knoobie

Oh, and notice that you should choose just one of the values fir the contain property, for example contain: paint.

jouni avatar Aug 18 '22 19:08 jouni