Skip to content
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

Responsive image srcset fallback with src output #346

Merged
merged 2 commits into from
Mar 17, 2020
Merged

Responsive image srcset fallback with src output #346

merged 2 commits into from
Mar 17, 2020

Conversation

uncenteredDiv
Copy link
Contributor

@uncenteredDiv uncenteredDiv commented Mar 16, 2020

Description

Adding srcSet to <Image> Component removes the src Attribute.
This PR will always output the src Attribute, even when a srcSet Object is passed.

This will improve the support for older Browsers, since they might don't support srcSet (like IE11). Using the Progressive Enhancement Approach newer Browsers can benefit from the srcSet and will ignore the src Attribute.

Motivation

Improve Support for older Browsers without the need for a srcSet Polyfill - which is difficult to implement when using Jss or Router Links.

How Has This Been Tested?

Tests for Image updated to test for srcSet / sizes Attributes output.
I used the same values as in the Styleguide Image Example.
Running npm run test inside root or /packages/sitecore-jss-react will run the new test

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have read the Contributing guide.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.

@sc-illiakovalenko
Copy link
Contributor

@unterweltler Thank you for contributing! It will solve problem in IE11.

@petervangennip
Copy link

petervangennip commented Oct 27, 2022

This would be a nice addition for the jss-vue packages too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants