-
Notifications
You must be signed in to change notification settings - Fork 25
Re-enable No JS Fallback #19
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
Comments
Hi @techwes! Sorry for taking a while to get back to you, it's been a hectic few weeks. Re-enabling the noscript fallback has been on my mind for a while. Things to considerVersioningThere is a small dilemma here:
One potential solution would be to release a new minor version, that bumps the noscript APIAnother thing is that the original API was relying on the user to match styles between the actual and noscript. We should consider if there is a better alternative. Would you be able to share a snippet of the Preact?When I tested it a few months back, Preact seemed ok with TimingSince it's the holidays I have some more time on my hands and could look into this more. Thanks for bringing it up as you did, it is super helpful :) |
Hello thank you for getting back to me and I apologize for the delay in my response. The holidays were a very busy time for me this year. To start below is my thin wrapper around import React, { Fragment } from 'react';
import { LazyImage } from 'react-lazy-images';
import classNames from 'classnames';
const placeholder = ({ imageProps, ref }) => (
<div
ref={ref}
className={classNames(imageProps.className, 'u-imgPlaceholder')}
/>
);
const actual = ({ imageProps }) => <img {...imageProps} />;
const LazyImg = props => {
return (
<Fragment>
<LazyImage {...props} actual={actual} placeholder={placeholder} />
<noscript>
<img {...props} />
</noscript>
</Fragment>
);
};
export default LazyImg; In order to make sure the placeholder does not take up any space in the layout I have this css rule: .no-js .u-imgPlaceholder {
display: none;
} Where I think the library could call the As far as versioning that is very tricky indeed. I am no expert here and am not sure what makes the most sense. You could split into two different modules, one with the fallback and one without but then you would have to add other new features to both and that doesn't seem worth it. It may end up being best to have the fallback as a separate add-on module so it can be conditionally included for those who need it and use a React version that supports it. Since we have both implemented it without access to any of the library internals, this is most likely very possible. |
Hey @fpapado! Have you settled on any final decision yet with Fallback component? Right now things are slightly confusing for new clients of the library: they need to investigate on their own what's the issue with I can submit a PR with Readme update if needed. |
Please, activate again this 🙌 |
Hello! First off I am a new user of react-lazy-images and want to thank you for your great work here!
Based on this comment and my personal experience using a noscript fallback in production (check out the Featured Venue images on this page with JS off) it seems like React has fixed the issue regarding using
<noscript>
. The code mentions that when this issue is fixed this library would once again offer a fallback API.I have no problems with how this was originally implemented and documented. I understand this really is not a priority since it is easy to implement along side this module but figured I would bring it up to put it on your radar. I may also be able to find time to implement this and submit a pull request if that works better for you.
The text was updated successfully, but these errors were encountered: