fix(try-it-out): Fix the width of image responses #7495
Merged
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.
This PR fixes an issue where images responses were stretched to the parent container's width. The issue was originally reported on Stack Overflow: https://stackoverflow.com/questions/68512725/swagger-ui-openapi-rendering-image-with-full-width
To reproduce the issue, open
https://petstore.swagger.io/?url=https://httpbin.org/spec.json#/Images/get_image
and test
GET /image
.Context
The issue appears to be a small regression introduced in PR #5578. That change replaced inline style
<img style={{ maxWidth: "100%" }}
with the CSS classimg.full-width { width: 100%; }
. That is, the new code appliedwidth
instead ofmax-width
, most likely an oversight. The current PR changeswidth
back tomax-width
.Note: An alternative fix would be to remove the
img.full-width
class entirely becauseimg
elements getmax-width: 100%
fromtachyons-sass
image styles used by Swagger UI - as shown on the image below. Let me know if you prefer to haveimg.full-width
style removed rather than updated.How Has This Been Tested?
Manually.
Screenshots (if appropriate):
Before the fix:
After the fix:
Checklist
My PR contains...
src/
is unmodified: changes to documentation, CI, metadata, etc.)package.json
)My changes...
Documentation
Automated tests