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

Slider doesn't visually reflect updates to the max prop #247

Open
ric2b opened this issue May 20, 2021 · 3 comments
Open

Slider doesn't visually reflect updates to the max prop #247

ric2b opened this issue May 20, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@ric2b
Copy link

ric2b commented May 20, 2021

Describe the bug

The Slider component doesn't visually reflect updates to the max prop (the underlying range input does correctly get an updated max attribute, though)

To Reproduce
https://svelte.dev/repl/a67aeecf3b334778b3640f8aadb2d1e1?version=3.38.2

  1. Click the header
  2. You'll see the slider move all the way to the end, even though it should still be at 50%

My guess is that there is some weird interaction with the bind on value, because it does update but is capped to 10, which is the pre-update max.

Expected behavior

It should visually reflect the update to max, like the standard range input does:
https://svelte.dev/repl/7a55a3285482467e9d40c2d505460e8b?version=3.38.2
(Based on the example in this Svelte issue: sveltejs/svelte#3857)

Desktop (please complete the following information):

  • OS: Ubuntu 21.04
  • Browser Firefox 88.0.1
@ric2b ric2b added the bug Something isn't working label May 20, 2021
@ric2b
Copy link
Author

ric2b commented May 20, 2021

I wonder if this is related:

$: if (instance) {
if (previousValue !== value) {
instance.setValue(value);
}
if (previousStart !== start) {
instance.setValueStart(start);
}
if (previousEnd !== end) {
instance.setValue(end);
}

Shouldn't line 295 be instance.setValueEnd(end);?

Although updating min also behaves weirdly: https://svelte.dev/repl/f58e8671c68a43e6ad92d743dd3ee0d7?version=3.38.2

@ric2b
Copy link
Author

ric2b commented May 21, 2021

In the meantime I found a workaround with Svelte key blocks, which allow you to destroy and rebuild their contents when the value of an expression changes.

The workaround looks like this: https://svelte.dev/repl/cdec4ea57d9c420e8d9fd87f6f59d43d?version=3.38.2

@nyanpasu
Copy link

I have run into this issue as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants