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

box-shadow is not rendered properly #1856

Open
hakimio opened this issue May 29, 2019 · 23 comments
Open

box-shadow is not rendered properly #1856

hakimio opened this issue May 29, 2019 · 23 comments

Comments

@hakimio
Copy link

hakimio commented May 29, 2019

Box shadow rendering which should be supported in rc2 doesn't seem to work properly. Here are a couple of simple tests both of which fail:
http://jsfiddle.net/p5yvxqLw/

Edit:
Setting border-radius to the second box produces even weirder results:
http://jsfiddle.net/Lmfwbgy2/

@hakimio hakimio closed this as completed May 29, 2019
@hakimio hakimio reopened this May 29, 2019
@hakimio
Copy link
Author

hakimio commented May 29, 2019

There seems to be some issue when the elements with box-shadow are not nested in other elements.

@hakimio
Copy link
Author

hakimio commented May 29, 2019

@niklasvh
Here is an example which is a bit more relevant to me and not only shows issues with box-shadow rendering but also a regression since RC1 with border rendering:
http://jsfiddle.net/s8ro3ghm/

@hakimio
Copy link
Author

hakimio commented May 29, 2019

And one more issue. Setting scale to > 1, causes shadow to be totally ignored:
http://jsfiddle.net/0wpo2nvz/

@hakimio
Copy link
Author

hakimio commented Jun 3, 2019

@eKoopmans @niklasvh any thoughts on the issues shown here?

@bhagatapoorva
Copy link

bhagatapoorva commented Jul 11, 2019

Hi @hakimio , did you find a solution to the box-shadow issue? I'm facing a similar problem.

@hakimio
Copy link
Author

hakimio commented Jul 13, 2019

@bhagatapoorva

  • There is something broken with offset calculation in RC2 and RC3. Might be the regression mentioned in issue v1.0.0-rc.2 breaks PR #1083  #1919 . Haven't tested yet. Also, setting x and y options to 0 seems to help but doesn't fix the issue completely.
  • Border-radius combined with box-shadow just doesn't work. Border-radius has to be removed.
  • Workaround for missing border regression introduced in RC2 can be found in issue Inconsistent border when some of side border is 'none' #1920 .

In general, if box-shadow support is not a must have, I would recommend using RC1 which has a lot less issues.

@Thul999
Copy link

Thul999 commented May 25, 2020

Has anyone found a solution to this issue?

@IgorKurkov
Copy link

Hi!
So I have tested RC1 and it works because there are no box-shadow at all in rendering.
In all another versions RC2+ and latest this issue still exist.
So my case looks on web like below (ordinary material card with box-shadow)
image

and html2canvas box-shadow issued:

image

I inserted a background:white'd <div> inside to make it a bit nicer by this idea https://stackoverflow.com/a/57201138/9026103
but it not helps as should :)

real issue looks without the div like:

image

any ideas?

@hakimio
Copy link
Author

hakimio commented Jun 3, 2021

It only ever worked without border radius.
Anyway, there is a PR which supposed to fix this and there are some proposed workarounds here.
Test it out and let us know if the fixes work.

@IgorKurkov
Copy link

Sorry, don't have enough time to test it now. I Will try on the next weekend

@lumenwrites
Copy link

Hey guys! I really need to use javascript to take a "screenshot" of a div with a box shadow and border radius.

Do you know if there are any possible workarounds to this?

@fe-art
Copy link

fe-art commented Feb 1, 2022

Hey @IgorKurkov @hakimio

Thank you for working on html2canvas

Any news concerning this issue ? <3

@IgorKurkov
Copy link

No news, I have skipped it and make rendering by puppeteer now. Because no ideas to solve

@brucexu-eth
Copy link

@p-cote @lumenwrites just found passing an option { scale: 2 } to the html2canvas can solve the issue. Have a try. I found the solution is because when making the screenshot on my 4K monitor, it is working, but on 2K monitor, not working.

@nikth0
Copy link

nikth0 commented Jul 22, 2022

here

doesn't work for me

@jadsy2107
Copy link

I've just stumbled across this issue, alas - i will find a solution ! Standby !

@jadsy2107
Copy link

I've just stumbled across this issue, alas - i will find a solution ! Standby !

Sorry guys html-to-cavas did it for us !!

@napstar-420
Copy link

This issue was opened on may 19, 2019. Today i had the same issue and after googling it i reached to this issue opened on github. And today is 24 december, 2022 approximately 3 years had passed but still no one has fixed it.

@chongchongLin
Copy link

now 2023/1/3 still no solution :(

@add-hi
Copy link

add-hi commented Sep 27, 2023

Still waiting for html2canvas...

But is there any suggested plugin for screenshots on React JS?

@saikatzahid2001
Copy link

Still not fixed! 😟 Any solution guys?

@summermong
Copy link

It still doesn't work in 2024 :/
PLZ tell me a different screenshot library...

michaelruocco added a commit to michaelruocco/naughts-and-crosses-ui that referenced this issue Mar 5, 2024
caendesilva added a commit to caendesilva/Windowlight that referenced this issue Apr 6, 2024
Html2Canvas is unable to handle box shadow correctly niklasvh/html2canvas#1856
@johnmartins
Copy link

I had the same issue. Switching to html-to-image package solved it for me

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

No branches or pull requests