Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS background-clip properties not displayed correctly #530

Closed
dudenhot opened this issue Sep 29, 2022 · 11 comments
Closed

CSS background-clip properties not displayed correctly #530

dudenhot opened this issue Sep 29, 2022 · 11 comments

Comments

@dudenhot
Copy link

dudenhot commented Sep 29, 2022

In the current version, a text with the following css does only show the background image but not the text (Microsoft Edge
Version 105.0.1343.50):

<div class="title">TITLE</div>
.title {    
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    background-image: linear-gradient(0deg, #45819D, #7FB0C5);
    font-weight: bold;
    font-size: 25px;
}

image

print window with version 1.0.10 (it works almost correctly, except the line above the text)
image

print window with current verion, only background image displayed:
image

@MatthewHerbst
Copy link
Owner

Hi, thanks for reporting. This appears to be an upstream bug in Chrome (Edge uses Chromium). If you try printing the page with just ctrl+p it also shows the same bug. I'll see if I can track something down for it

@MatthewHerbst MatthewHerbst changed the title CSS with background-image and background-clip properties is not displayed correctly CSS background-clip properties not displayed correctly Sep 29, 2022
@MatthewHerbst
Copy link
Owner

Example of this being completely unrelated to react-to-print: https://2c46s7.csb.app/

@MatthewHerbst
Copy link
Owner

A related but slightly different issue (improper printing on the downloaded PDF): https://bugs.chromium.org/p/chromium/issues/detail?id=883026

@MatthewHerbst
Copy link
Owner

This appears to be an issue on Safari as well. I wonder if the above issue is more related than we think. Are you on a Windows machine or MacOS?

@dudenhot
Copy link
Author

I work on a Windows machine.

@MatthewHerbst
Copy link
Owner

I can reproduce on Firefox as well 😢

@MatthewHerbst
Copy link
Owner

My guess is your best bet is to just find a different way to do it with CSS, since it seems no browser supports background-clip while printing unfortunately

@MatthewHerbst
Copy link
Owner

I created an issue against Chromium to track this: https://bugs.chromium.org/p/chromium/issues/detail?id=1369475

@dudenhot
Copy link
Author

My guess is your best bet is to just find a different way to do it with CSS, since it seems no browser supports background-clip while printing unfortunately

Ok, but I'm wondering why it works with the older version

@MatthewHerbst
Copy link
Owner

I'm wondering why it works with the older version

Older versions of this library used to add the -webkit-print-color-adjust: exact; style:

https://github.com/gregnb/react-to-print/blob/7529a676401780c8eeaf1a8de351e70c0487b92d/src/index.js#L104

If you add that to the CodeSanbox I posted you can see that it prints semi-correctly (with the line)

@dudenhot
Copy link
Author

I'm wondering why it works with the older version

Older versions of this library used to add the -webkit-print-color-adjust: exact; style:

https://github.com/gregnb/react-to-print/blob/7529a676401780c8eeaf1a8de351e70c0487b92d/src/index.js#L104

If you add that to the CodeSanbox I posted you can see that it prints semi-correctly (with the line)

Ok, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants