metafizzy / metafizzy/flickity
Bug in resize function caused by #1177 fix
- Dominant language
- JavaScript
- Stars
- 7.6k
- Forks
- 593
- PR merge metrics
- No merged PRs in 30d
Description
**Test case:** https://codepen.io/andyexeter/pen/mdBZJwb
Hey,
A bug has been introduced in https://github.com/metafizzy/flickity/commit/73249f9002f6af3160452f6c7591366094279524 which was added as a fix for #1177
Now that the resize function bails if the carousel is animating, triggering any elements within a cell to show on an adaptiveHeight carousel and then resizing doesn't work.
In the test case, if you scroll to cell 2 then click the "Show" button nothing happens. However, if you reload, scroll to cell 2 and wait a couple of seconds for the animation to settle and then click Show, the carousel is resized correctly to show the new visible content.
I've added a commented out temporary workaround to the test case, where I check the `isAnimating` property before calling `resize` and if it's true I wait for a `settle` event to fire before resizing. This _kind of_ works, but there's a noticeable delay between clicking the button and the resize occurring.
Contributor guide
Research direction
Reproduce the behavior with the linked CodePen test case, focusing on cell 2, adaptiveHeight, resize, isAnimating, and the settle event. Read commit 73249f9002f6af3160452f6c759136609427952e and issue #1177 to understand the regression; done means resizing after clicking “Show” updates the carousel immediately while animation is still settling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100