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

[@astrojs/image] sizes and background props should be optional on <Picture> #6125

Closed
1 task
jkjustjoshing opened this issue Feb 4, 2023 · 0 comments · Fixed by #6773
Closed
1 task

[@astrojs/image] sizes and background props should be optional on <Picture> #6125

jkjustjoshing opened this issue Feb 4, 2023 · 0 comments · Fixed by #6773
Labels
- P2: nice to have Not breaking anything but nice to have (priority) pkg: image Related to the `@astrojs/image` package (scope)

Comments

@jkjustjoshing
Copy link
Contributor

jkjustjoshing commented Feb 4, 2023

What version of astro are you using?

2.0.6

Are you using an SSR adapter? If so, which one?

No

What package manager are you using?

npm

What operating system are you using?

Mac

Describe the Bug

The <Picture> component has 2 required props that don't make sense to me as being required:

sizes

This is a pass-through prop that gets added to the underlying HTML elements. An HTML <picture> element doesn't require this attribute, so why does Astro? My understanding is that this attribute is only used for different art direction at different sizes, so requiring it for use cases where the different images are identical except for resolution is unnecessary.

background

The documentation says that "it’s advisable to include a background color, otherwise black will be used as default replacement for transparent pixels". If this prop has a default value ("black"), why am I being made to add this prop, especially if I'm only using JPEGs (with no transparency)?

Link to Minimal Reproducible Example

https://codesandbox.io/p/sandbox/picture-requires-sizes-and-background-3ugksq (see the Typescript error on the <Picture> element usage)

Participation

  • I am willing to submit a pull request for this issue.
@matthewp matthewp added the - P2: nice to have Not breaking anything but nice to have (priority) label Feb 8, 2023
@Princesseuh Princesseuh added the pkg: image Related to the `@astrojs/image` package (scope) label Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P2: nice to have Not breaking anything but nice to have (priority) pkg: image Related to the `@astrojs/image` package (scope)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants