-
Notifications
You must be signed in to change notification settings - Fork 361
[Image] | (DX) | Remove ZoomService in favor of WB Modal #3009
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
Conversation
…ove ZoomService in favor of WB Modal
🗄️ Schema Change: No Changes ✅ |
|
Size Change: -2.09 kB (-0.42%) Total Size: 497 kB
ℹ️ View Unchanged
|
🛠️ Item Splitting: No Changes ✅ |
npm Snapshot: PublishedGood news!! We've packaged up the latest commit from this PR (aa8d559) and published it to npm. You Example: pnpm add @khanacademy/perseus@PR3009If you are working in Khan Academy's frontend, you can run the below command. ./dev/tools/bump_perseus_version.ts -t PR3009If you are working in Khan Academy's webapp, you can run the below command. ./dev/tools/bump_perseus_version.js -t PR3009 |
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.
Deleted zoom code
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.
if not yet in our decision page, please add the decision why it this is removed
…e-zoom-with-modal
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.
Removed these cypress tests now that the unit tests cover the same thing.
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.
do we want to retain the testing but updated logic?
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.
We had a meeting about this last week when you were gone. We're going to move away from using cypress within the perseus repo altogether.
Cypress in frontend is still used though.
…han functions to remove hooks warning
…f screen on mobile
ivyolamit
left a comment
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.
@nishasy overall code looks good. Just one comment for code changes on removing unused css styling. The rest are question and non-blocking comment.
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.
do we want to retain the testing but updated logic?
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.
if not yet in our decision page, please add the decision why it this is removed
|
Note to self: DO NOT LAND UNTIL QA IS COMPLETE |
catandthemachines
left a comment
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.
Thank you so much for this improvement, it's so much cleaner and easier to read compared to the old zoom code. I had one question on the "closing dialog when image is clicked", but it's non blocking.
Thanks Nisha!
| @@ -0,0 +1,14 @@ | |||
| .contentWrapper { | |||
| /* Undo the ModalContent padding so that the image takes up the whole modal. */ | |||
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.
Thank you for these comments!
| line-height: 1.5; | ||
| margin: 0; | ||
| } | ||
| /* Derived from the MIT-licensed zoom.js: |
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.
Yay!!
| <SvgImage | ||
| src={imageDescription.url} | ||
| allowZoom={false} | ||
| // Don't allow zooming on an image that's being |
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.
nit: I'd move it above the property like other comments for consistency
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.
Oh idk how that happened haha
| expect(screen.getByRole("dialog")).toBeVisible(); | ||
| }); | ||
|
|
||
| it("closes the modal when the image is clicked", async () => { |
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.
Question, was that in the old experience? Why should the modal close if the image is clicked? What if someone wants to copy the image or look at more closely? Closing on clicking the image seem odd.
Non-blocking and ignore me if design prefers this.
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 was just trying to get it as close to the old experience as possible. You can see that in prod (Image article).
The old experience closed the modal with a click, space, enter, or escape anywhere within the zoomed view. This doesn't stop right-clicking. It also manually handles control+click/command+click to open the image in a new tab (which I manually implemented in the new experience too).
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] ### Minor Changes - [#3037](#3037) [`39c890acc5`](39c890a) Thanks [@nishasy](https://github.com/nishasy)! - [Image] | (UX) | Allow zooming on Graphie images - [#3009](#3009) [`8d3beb2743`](8d3beb2) Thanks [@nishasy](https://github.com/nishasy)! - [Image] | (DX) | Remove ZoomService in favor of WB Modal ### Patch Changes - [#3044](#3044) [`78e15ef4e6`](78e15ef) Thanks [@nishasy](https://github.com/nishasy)! - [Image] | (UX) | Image zoom fixes - remove scrolling for portrait images, command click on main image instead of zoomed image - [#3043](#3043) [`98245b0f3a`](98245b0) Thanks [@ivyolamit](https://github.com/ivyolamit)! - Fix bottom margin when rendering in mobile - Updated dependencies \[[`ceb7a70bfa`](ceb7a70), [`fc6273b10d`](fc6273b), [`18261c3294`](18261c3)]: - @khanacademy/[email protected] - @khanacademy/[email protected] ## @khanacademy/[email protected] ### Minor Changes - [#3047](#3047) [`b84bc99def`](b84bc99) Thanks [@nishasy](https://github.com/nishasy)! - Add Issues Panel to Article Editor - [#2992](#2992) [`fc6273b10d`](fc6273b) Thanks [@nishasy](https://github.com/nishasy)! - Add radio and expression save wanrnings to the perseus linter. Add a callback for issues changed to item-editor.tsx. - [#3037](#3037) [`39c890acc5`](39c890a) Thanks [@nishasy](https://github.com/nishasy)! - [Image] | (UX) | Allow zooming on Graphie images ### Patch Changes - [#3044](#3044) [`78e15ef4e6`](78e15ef) Thanks [@nishasy](https://github.com/nishasy)! - [Image] | (UX) | Image zoom fixes - remove scrolling for portrait images, command click on main image instead of zoomed image - [#3049](#3049) [`18261c3294`](18261c3) Thanks [@nishasy](https://github.com/nishasy)! - Add Free Response widget save warnings to perseus linter - Updated dependencies \[[`ceb7a70bfa`](ceb7a70), [`78e15ef4e6`](78e15ef), [`fc6273b10d`](fc6273b), [`39c890acc5`](39c890a), [`8d3beb2743`](8d3beb2), [`98245b0f3a`](98245b0), [`18261c3294`](18261c3)]: - @khanacademy/[email protected] - @khanacademy/[email protected] - @khanacademy/[email protected] ## @khanacademy/[email protected] ### Minor Changes - [#2992](#2992) [`fc6273b10d`](fc6273b) Thanks [@nishasy](https://github.com/nishasy)! - Add radio and expression save wanrnings to the perseus linter. Add a callback for issues changed to item-editor.tsx. - [#3049](#3049) [`18261c3294`](18261c3) Thanks [@nishasy](https://github.com/nishasy)! - Add Free Response widget save warnings to perseus linter ## @khanacademy/[email protected] ### Patch Changes - [#3054](#3054) [`ceb7a70bfa`](ceb7a70) Thanks [@ivyolamit](https://github.com/ivyolamit)! - Add tabs and icon button package in math-input
Summary:
The old zoom service is a huge pain to work with. It's super old and very
non-modern-reacty.
I'm replacing it here with Wonder Blocks modal so that the zoom feature can be
easier to work with and maintain.
This is a prerequisite for making the graphies focusable and zoomable since the
old zoom service was trying to do too much with the image ref, making it impossible
to zoom in on graphies with their labels.
NOTE: The nice little transition is unfortunately gone with this approach. But I got
confirmation from our designer that we can go with this for now, and we can add
in transitions once WB Modal supports it next year.
Issue: https://khanacademy.atlassian.net/browse/LEMS-3689
Test plan:
Storybook
/?path=/story/widgets-image-widget-demo--image-with-different-sizesBefore
Screen.Recording.2025-10-30.at.5.14.11.PM.mov
After
Screen.Recording.2025-10-30.at.5.15.18.PM.mov