WS-2615-extra: Better handles billboard image on high retina displays… - #14255
Draft
Isabella-Mitchell wants to merge 2 commits into
Draft
WS-2615-extra: Better handles billboard image on high retina displays…#14255Isabella-Mitchell wants to merge 2 commits into
Isabella-Mitchell wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the Billboard component’s responsive image srcset generation to better support high-DPI/retina displays by allowing a 2x (1320w) image candidate, and adds a regression test for the new behavior.
Changes:
- Add a retina target width (1320) and pass custom
imageResolutionsintocreateSrcsetsfor high-prominence billboards. - Update
originalImageWidthused forcreateSrcsetsto allow generating a 1320wsrcsetcandidate. - Add a test asserting that the retina width is present in the generated
srcset.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/app/components/Billboard/index.tsx | Adds retina-aware image resolution handling for high prominence billboard images. |
| src/app/components/Billboard/index.test.tsx | Adds coverage for the new 2x srcset behavior. |
| // 2x the fixed 660px display width (desktop ≥1280px), so high-DPI/retina | ||
| // screens get a sharp source instead of upscaling the 660w image. | ||
| const IMAGE_WIDTH_RETINA = IMAGE_WIDTH * 2; | ||
| const IMAGE_RESOLUTIONS = [240, 320, 480, 624, 800, IMAGE_WIDTH_RETINA]; |
Comment on lines
+296
to
+310
| it('includes a retina (2x) resolution in the srcset so high-DPI screens are not upscaled', () => { | ||
| render( | ||
| <Billboard | ||
| heading={title} | ||
| description={description} | ||
| link={link} | ||
| image={imageUrl} | ||
| altText={imageAlt} | ||
| prominence={VISUAL_PROMINENCE.HIGH} | ||
| />, | ||
| ); | ||
|
|
||
| const image = screen.getByAltText(imageAlt); | ||
| expect(image.getAttribute('srcset')).toContain('1320w'); | ||
| }); |
Comment on lines
+39
to
+41
| // 2x the fixed 660px display width (desktop ≥1280px), so high-DPI/retina | ||
| // screens get a sharp source instead of upscaling the 660w image. | ||
| const IMAGE_WIDTH_RETINA = IMAGE_WIDTH * 2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Resolves JIRA: WS-NA (Stretch task of https://bbc.atlassian.net/browse/WS-2615 - will make a separate ticket if it needs one)
Alternative (more complex yet more effective approach) to #14259
Summary
Updates the Billboard component’s responsive image srcset generation to better support high-DPI/retina displays by allowing a 2x (1320w) image candidate, and adds a regression test for the new behavior.
Code changes
Considerations
Testing
Use storybook or compare test asset, e.g. http://localhost:7081/kyrgyz?renderer_env=test and https://www.test.bbc.com/kyrgyz
See image is a considerably less blurry
Useful Links