Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add new 'raw' image layout #34339
Add new 'raw' image layout #34339
Changes from 29 commits
889a3c8
ebafcca
7ab3c8a
2c62327
4c769d3
5843826
4252ffb
c4fa96b
4006b36
efad4b8
26a6103
f32440d
78904f2
c457914
bdd8836
e812837
90c778d
34411f2
64a0b70
435091e
2be4e4e
6c9a9e4
d9f51f1
ebf5812
80ffd7e
b4fdc15
24cf3dc
8c12019
74ac553
8904782
2f91512
cac28f0
3be7243
9c5b9b8
adb3a57
dd21513
6baa8be
19ffddc
e03c65b
20955eb
b64bda7
78b9434
7338c3a
bc42437
5eea550
d3d82b6
57edfe0
d4e19f2
a3aae1b
2e6e84d
7525553
9f41f20
c4654fa
820b152
8563475
74076ff
a000df1
d48b36a
531b623
d22691d
b5b1375
6a5ffac
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like "Behaves like
responsive
if the images has thesizes
prop" isn't true right now because it doesnt automatically stretch to fit the viewport like responsive does. This is because thewidth
andheight
props go directly to the underlying<img>
.It seems like we need a way to maintain aspect ratio from width/height without setting the attributes to get the true responsive behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re docs: maybe instead of trying to make direct comparisons to other layout modes, we can just list what the srcset is directly for both cases (e.g. '1x', '2x' if sizes is set, otherwise '
640w
,750w
, ...2048w
,3840w
(based on imageSizes and deviceSizes). But then there's still the issue of aspect ratio.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @kara , the whole purpose of
raw
is to not add layout behaviors.The "responsive" behavior from the browser is to download the right image version according to
height
,width
,sizes
andsrcset
attributes. Nothing should come in the way of of this.I'd even argue if a user passes
srcset
prop when inraw
layout, the values from the user should be passed directly to the<img>
without any modification.I think a default of
1x
/2x
or640w, 750w, ...,3840w
depending ifsizes
is set or not is fine, just don't prevent people from generating their ownsrcset
. What I consider should always be640w, ...3840w
might be different for another person and vice versa. The whole point ofraw
is to give back the power to users, defaults are welcome if not forced on you.