Skip to content

Conversation

@Kneemund
Copy link

@Kneemund Kneemund commented Jan 9, 2026

This PR adds an early return to the slideDown / slideDown function that skips the animation if the duration is less than (or equal to) 1.


Currently, when the duration is zero, the second timeout runs BEFORE the first one (at least on Firefox), and doesn't properly clear the style attributes:

globalThis.setTimeout(() => {
target.style.boxSizing = 'border-box'
target.style.transitionProperty = 'height, margin, padding'
target.style.transitionDuration = `${duration}ms`
target.style.height = `${height}px`
target.style.removeProperty('padding-top')
target.style.removeProperty('padding-bottom')
target.style.removeProperty('margin-top')
target.style.removeProperty('margin-bottom')
}, 1)
globalThis.setTimeout(() => {
target.style.removeProperty('height')
target.style.removeProperty('overflow')
target.style.removeProperty('transition-duration')
target.style.removeProperty('transition-property')
}, duration)


This fixes a bug in the sidebar treeview, where this function is used with a duration of zero to instantly open entries when the page loads:

slideDown(childElement, 0)

As an alternative fix, the duration parameter could be clamped to be greater than 1.

@netlify
Copy link

netlify bot commented Jan 9, 2026

Deploy Preview for adminlte-v4 ready!

Name Link
🔨 Latest commit 7d69692
🔍 Latest deploy log https://app.netlify.com/projects/adminlte-v4/deploys/696a26b73c805b00085b110f
😎 Deploy Preview https://deploy-preview-5964--adminlte-v4.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@dfsmania
Copy link
Contributor

@Kneemund would this same fix applicable to slideUp()?
I'm also trying to improve Typescript logic of this package when I got some free time.

@Kneemund
Copy link
Author

That function is never used with a duration of 0. But you're right, it could happen, so the fix should be applied to that function too.

@Kneemund Kneemund changed the title fix: early return from slideDown if duration is zero fix: early return from slideDown/slideUp if duration is less than 1 Jan 16, 2026
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.

2 participants