Skip to content

Fix invalid calc() that silently dropped two box-shadows - #845

Open
AlexCherrypi wants to merge 1 commit into
PRProd:mainfrom
AlexCherrypi:fix/invalid-calc-in-box-shadow
Open

Fix invalid calc() that silently dropped two box-shadows#845
AlexCherrypi wants to merge 1 commit into
PRProd:mainfrom
AlexCherrypi:fix/invalid-calc-in-box-shadow

Conversation

@AlexCherrypi

Copy link
Copy Markdown

The blur radius and the spread value are both inside calc():

box-shadow: rgb(0 0 0 / 13%) 0 calc(var(--sz) * 0.214rem) calc(var(--sz) * 0.143rem 0);

calc() takes a single expression, so the trailing 0 makes the function invalid. Per CSS error handling the browser discards the entire box-shadow declaration rather than just that value.

Two rules are affected:

line selector
1185 .remote-button
1871 .apple-remote-body .srcButton

Both render without any shadow today. It is easiest to see on the Chromecast skin, where the app launcher buttons cast a shadow but the round buttons right next to them do not, even though both were written to have one.

The fix moves the spread value outside the parentheses:

box-shadow: rgb(0 0 0 / 13%) 0 calc(var(--sz) * 0.214rem) calc(var(--sz) * 0.143rem) 0;

That is the same form the other twenty box-shadow declarations in this stylesheet already use, so the intended values are unchanged — they simply take effect now.

Found while styling a Chromecast remote and wondering why only some buttons had shadows.

The blur radius and the spread value were both placed inside calc():

    calc(var(--sz) * 0.143rem 0)

calc() accepts a single expression, so the trailing 0 makes the whole
function invalid. Per CSS error handling the browser then discards the
entire box-shadow declaration, not just that one value.

As a result .remote-button and .apple-remote-body .srcButton render with
no shadow at all. On the Chromecast skin this is easy to spot: the app
launcher buttons have a shadow while the round buttons next to them do
not, although both are meant to have one.

Moving the spread outside the parentheses restores the shadow the values
were written for. Twenty other box-shadow declarations in the same
stylesheet already use this form.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant