fix(parallax): add position properties to layer #1530
Merged
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.
Why
Found this bug while making the new demo for testing (I didn't even set up
cypressyet 😅):If more than 2 layers are sticky on the same page, their positions may be suddenly shifted down a page before becoming sticky when scrolled to a second time (depending on their order in the HTML). Description might not be totally clear, but you can see what I mean here: https://codesandbox.io/s/nifty-night-j6xdm?file=/src/App.tsx.
Obviously, I had to discover this the day after 9.2.0 released.
What
Instead of having conditional position properties like this:
All four are now listed explicitly (
top: 0, bottom: 0, etc..). This has no effect on regular layers.In the future when the
insetproperty has more support we can switch it to that so it looks a little cleaner, but that's a nitpick really. (Also, by that time,overflow: clipwill hopefully be better supported and we can just use that instead and none of this will matter anyways.)Checklist