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

fix(sl-range): add value change handler #572

Merged

Conversation

timefordroids
Copy link
Contributor

When we update the value for sl-range programmatically, then the active and inactive portions of the track are not updated according to the new value.

@vercel
Copy link

vercel bot commented Oct 18, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/shoelace/shoelace/3TJRoHiM11yFYNxpZCDDrVDaHrN3
✅ Preview: https://shoelace-git-fork-timefordroids-fix-sl-range-va-6dfb8e-shoelace.vercel.app

this.invalid = !this.input.checkValidity();
}

requestAnimationFrame(() => this.syncRange());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason for requestAnimationFrame here? Seems to work fine without it, but I'm curious to know if it solved a browser-specific issue you discovered.

Good catch on the validity check, too!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, it works fine in common cases. But I'm discovered some twitching on my project when the value updated without requestAnimationFrame.

@claviska claviska merged commit 25aa831 into shoelace-style:next Oct 19, 2021
@claviska
Copy link
Member

Thanks again. I dug into this and I don't see a reason for RAF in handleInput() or handleValueChange(). I tested in all browsers by manually and programmatically setting values and everything seems smooth. If you're seeing a twitch in your app in the next beta, let's try for a repro so we can narrow it down.

@timefordroids
Copy link
Contributor Author

Sure. Thank you 👌

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.

None yet

2 participants