Skip to content

Commit c48e6e0

Browse files
authored
Merge pull request #14430 from guardian/doml/safari-highlights-tranparency
Fix visual bugs in Safari v14
2 parents fb35a0d + 7b45ef4 commit c48e6e0

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

dotcom-rendering/src/components/Card/components/CardWrapper.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,23 @@ const baseCardStyles = css`
2020
flex-direction: column;
2121
justify-content: space-between;
2222
width: 100%;
23-
/* We absolutely position the faux link
24-
so this is required here */
23+
/* We absolutely position the faux link so this is required here */
2524
position: relative;
2625
27-
/* Target Safari 10.1 */
28-
/* https://www.browserstack.com/guide/create-browser-specific-css */
26+
/*
27+
* Target Safari 10.1 to 14.0
28+
* https://www.browserstack.com/guide/create-browser-specific-css
29+
* Flexbox with gap is not supported until Safari 14.1
30+
*/
2931
@media not all and (min-resolution: 0.001dpcm) {
30-
@supports (-webkit-appearance: none) and
31-
(not (stroke-color: transparent)) {
32+
@supports (-webkit-appearance: none) and (not (display: flex; gap: 1em)) {
3233
display: grid;
3334
grid-auto-rows: min-content;
3435
align-content: start;
3536
}
3637
}
3738
38-
/* a tag specific styles */
39+
/* <a /> tag specific styles */
3940
color: inherit;
4041
text-decoration: none;
4142
`;

dotcom-rendering/src/paletteDeclarations.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5887,8 +5887,16 @@ const highlightContainerMidFadeLight: PaletteFunction = () =>
58875887
const highlightContainerMidFadeDark: PaletteFunction = () =>
58885888
transparentColour(sourcePalette.neutral[10], 0.6);
58895889

5890-
const highlightContainerEndFadeLight: PaletteFunction = () => 'transparent';
5891-
const highlightContainerEndFadeDark: PaletteFunction = () => 'transparent';
5890+
/**
5891+
* Why not 'transparent'?
5892+
*
5893+
* Older versions of Safari (v14 and lower) misinterpret "transparent"
5894+
* when used in gradients: https://css-tricks.com/thing-know-gradients-transparent-black/
5895+
*/
5896+
const highlightContainerEndFadeLight: PaletteFunction = () =>
5897+
transparentColour(sourcePalette.neutral[100], 0);
5898+
const highlightContainerEndFadeDark: PaletteFunction = () =>
5899+
transparentColour(sourcePalette.neutral[10], 0);
58925900

58935901
const pinnedPostBorderLight: PaletteFunction = ({ theme }) => {
58945902
switch (theme) {

0 commit comments

Comments
 (0)