griffel icon indicating copy to clipboard operation
griffel copied to clipboard

Cannot use `background-position`

Open miroslavstastny opened this issue 3 years ago • 2 comments
trafficstars

Griffel does not support background-position. That is expected as it is a CSS shorthand. We are supposed to use background-position-x and background-position-y longhands instead.

Shorthand works

The problem is with

background-position: center bottom 10px;

It works consistently across browsers:

Chrome 104 Firefox 104 Safari 15.6.1
image image image

Codesandbox: https://codesandbox.io/s/empty-wood-1m917y

Longhands broken in Chrome 104

Once we expand that to longhands:

background-position-x: center;
background-position-y: bottom 10px;

The result is still the same in Firefox and Safari but breaks in Chrome:

Chrome 104 Firefox 104 Safari 15.6.1
image image image

Codesandbox: https://codesandbox.io/s/vibrant-heyrovsky-7ezu6h

miroslavstastny avatar Aug 31 '22 15:08 miroslavstastny

Chrome shows an error in devtools: image

miroslavstastny avatar Aug 31 '22 15:08 miroslavstastny

Chromium issue for the longhand bug: https://bugs.chromium.org/p/chromium/issues/detail?id=610627&q=background-position-y&can=2

nadnad avatar Jan 05 '23 15:01 nadnad

@miroslavstastny backgroundPosition can be used now as we support CSS shorthands now, see #531.

layershifter avatar May 03 '24 08:05 layershifter