Skip to content

Commit

Permalink
Adding alt tag to image widget on zoom (#1942)
Browse files Browse the repository at this point in the history
## Summary:
This is a simple PR to ensure that we're retaining any pre-existing image alt tags when the user zooms in on an image. 

While I created a storybook view for testing this work, I have removed it before opening up the PR for review as I am unsure about potential image copyright issues. 

Issue: A11Y-41

## Test plan:
- manual test with storybook 
- manual test in webapp with PR

Author: SonicScrewdriver

Reviewers: mark-fitzgerald, catandthemachines

Required Reviewers:

Approved By: mark-fitzgerald, catandthemachines

Checks: ✅ gerald, ✅ Cypress (ubuntu-latest, 20.x), ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ gerald, ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 20.x), ✅ gerald

Pull Request URL: #1942
  • Loading branch information
SonicScrewdriver authored Dec 3, 2024
1 parent 5e8d846 commit 1d2b4e7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/hip-pandas-argue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus": patch
---

Ensure that zoomed-in images retain alt text
1 change: 1 addition & 0 deletions packages/perseus/src/zoom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ Zoom.prototype.zoomImage = function () {
}.bind(this);

img.src = this._targetImage.src;
img.alt = this._targetImage.alt;

this.$zoomedImage = $zoomedImage;
};
Expand Down

0 comments on commit 1d2b4e7

Please sign in to comment.