[Image] | (UX) | Stop large images from overflowing#3429
Conversation
…erflowing I noticed that large images without a size overflow past the bounds. Note that this case is currently only possible behind the scale feature flag (the non-flag implementation always finds a size for the image). Fixing that here by giving the image loader a max width of 100% to prevent it from growing larger than its container. Issue: none Test plan: - `/?path=/story/widgets-image-widget-demo--large-image-with-no-size-saved-scale-flag` - `/?path=/story/widgets-image-widget-demo--small-image-with-no-size-saved-scale-flag`
…ge images from overflowing
🗄️ Schema Change: No Changes ✅ |
|
Size Change: 0 B Total Size: 494 kB ℹ️ View Unchanged
|
npm Snapshot: PublishedGood news!! We've packaged up the latest commit from this PR (a9ab193) and published it to npm. You Example: pnpm add @khanacademy/perseus@PR3429If you are working in Khan Academy's frontend, you can run the below command. ./dev/tools/bump_perseus_version.ts -t PR3429If you are working in Khan Academy's webapp, you can run the below command. ./dev/tools/bump_perseus_version.js -t PR3429 |
| backgroundImage: {url: frescoImage.url}, | ||
| alt: "Fresco painting", | ||
| }, | ||
| }; |
There was a problem hiding this comment.
This regression story doesn't have the scale flag, but it should make sure that nothing changes after the scale flag is removed.
🛠️ Item Splitting: No Changes ✅ |
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
catandthemachines
left a comment
There was a problem hiding this comment.
These CSS changes look good to me. Thanks Nisha!
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @khanacademy/[email protected] ### Patch Changes - [#3429](#3429) [`41bea5fd10`](41bea5f) Thanks [@nishasy](https://github.com/nishasy)! - [Image] | (UX) | Stop large images from overflowing - [#3413](#3413) [`06ac0a160d`](06ac0a1) Thanks [@nishasy](https://github.com/nishasy)! - [Image] | (UX) | Don't upscale images within explore modal if size is unknown - [#3426](#3426) [`dae8b1d931`](dae8b1d) Thanks [@nishasy](https://github.com/nishasy)! - [Image] | (a11y) | Update zoom view SRUX ## @khanacademy/[email protected] ### Patch Changes - Updated dependencies \[[`41bea5fd10`](41bea5f), [`06ac0a160d`](06ac0a1), [`dae8b1d931`](dae8b1d)]: - @khanacademy/[email protected] Author: khan-actions-bot Reviewers: claude[bot], anakaren-rojas Required Reviewers: Approved By: anakaren-rojas Checks: ⏭️ 2 checks have been skipped, ✅ 6 checks were successful Pull Request URL: #3430
## Summary: I noticed that large images without a size overflow past the bounds ([article](https://www.khanacademy.org/science/ms-physics/x1baed5db7c1bb50b:teacher-resources/x1baed5db7c1bb50b:unit-guides/a/middle-school-physics-unit-guides)). Note that this case is currently only possible behind the scale feature flag (the non-flag implementation always finds a size for the image). Fixing that here by giving the image loader a max width of 100% to prevent it from growing larger than its container. Issue: none ## Test plan: - `/?path=/story/widgets-image-widget-demo--large-image-with-no-size-saved-scale-flag` - `/?path=/story/widgets-image-widget-demo--small-image-with-no-size-saved-scale-flag` | Before | After | | --- | --- | | large | large | | <img width="1727" height="1044" alt="Screenshot 2026-03-30 at 2 32 22 PM" src="https://github.com/user-attachments/assets/632716f4-6024-4029-a92b-1351a5df42c8" /> | <img width="1727" height="1045" alt="Screenshot 2026-03-30 at 2 32 43 PM" src="https://github.com/user-attachments/assets/be747285-0f00-491a-b485-7aa12ed6f0ea" /> | | small | small | | <img width="1728" height="1043" alt="Screenshot 2026-03-30 at 2 32 30 PM" src="https://github.com/user-attachments/assets/a120379d-f31b-439c-9bcc-83fc696341ac" /> | <img width="1726" height="1044" alt="Screenshot 2026-03-30 at 2 32 52 PM" src="https://github.com/user-attachments/assets/4b8e12e2-3b4a-464a-aea0-ae2253ef1d5b" /> | Author: nishasy Reviewers: nishasy, claude[bot], catandthemachines, mark-fitzgerald, ivyolamit Required Reviewers: Approved By: catandthemachines Checks: ⏭️ 1 check has been skipped, ✅ 10 checks were successful Pull Request URL: #3429
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @khanacademy/[email protected] ### Patch Changes - [#3429](#3429) [`41bea5fd10`](41bea5f) Thanks [@nishasy](https://github.com/nishasy)! - [Image] | (UX) | Stop large images from overflowing - [#3413](#3413) [`06ac0a160d`](06ac0a1) Thanks [@nishasy](https://github.com/nishasy)! - [Image] | (UX) | Don't upscale images within explore modal if size is unknown - [#3426](#3426) [`dae8b1d931`](dae8b1d) Thanks [@nishasy](https://github.com/nishasy)! - [Image] | (a11y) | Update zoom view SRUX ## @khanacademy/[email protected] ### Patch Changes - Updated dependencies \[[`41bea5fd10`](41bea5f), [`06ac0a160d`](06ac0a1), [`dae8b1d931`](dae8b1d)]: - @khanacademy/[email protected] Author: khan-actions-bot Reviewers: claude[bot], anakaren-rojas Required Reviewers: Approved By: anakaren-rojas Checks: ⏭️ 2 checks have been skipped, ✅ 6 checks were successful Pull Request URL: #3430
Summary:
I noticed that large images without a size overflow past the bounds (article).
Note that this case is currently only possible behind the scale feature flag
(the non-flag implementation always finds a size for the image).
Fixing that here by giving the image loader a max width of 100% to prevent it
from growing larger than its container.
Issue: none
Test plan:
/?path=/story/widgets-image-widget-demo--large-image-with-no-size-saved-scale-flag/?path=/story/widgets-image-widget-demo--small-image-with-no-size-saved-scale-flag