Closed Lper258 closed 5 months ago
I think this is expected since the scoped class/attribute is passed to the component directly, so pictureAttributes
didn't received the extra scoped class/attribute that would've made it work. Seems like the scoped attribute works for the fallback img
by default though. Maybe it's worth making this usecase work, but we'd need to special case some special attributes or classes to pass on to the picture
or img
.
I don't think we should do this, this is an issue any time you use a component and attempt to set its classes. The solution, like with markdown, is to use global CSS for that.
After talking about it, @bluwy thinks he might know of a way to fix this.
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
When passing
pictureAttributes
prop to Astro's<Picture />
component, the passed class DOES get applied to the generated HTML<picture />
tag, but it seems that the styles are not generate i.e. the class has no styles.WARNING: Minimal reproducible example on StackBlitz works for me only in Chrome. Sometimes the image in the local src/assets/ directory is loaded, some times it is not, but the reported issue is still visible.
What's the expected result?
The class gets applied to the generated
<picture />
tag, AND it contains the correct styles.Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-qrod97
Participation