mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 10:21:05 +00:00
fix(slider): dont update slider if disabled
This commit is contained in:
parent
5e8915df7f
commit
4be4c498b6
2 changed files with 4 additions and 2 deletions
|
@ -4,7 +4,7 @@
|
|||
import Slider from "./Slider.svelte";
|
||||
import SliderSkeleton from "./Slider.Skeleton.svelte";
|
||||
|
||||
$: value = 50;
|
||||
let value = 50;
|
||||
</script>
|
||||
|
||||
{#if story === 'skeleton'}
|
||||
|
|
|
@ -129,6 +129,8 @@
|
|||
}
|
||||
|
||||
function calcValue(e) {
|
||||
if (disabled) return;
|
||||
|
||||
const offsetX = e.touches ? e.touches[0].clientX : e.clientX;
|
||||
const { left, width } = trackRef.getBoundingClientRect();
|
||||
let nextValue =
|
||||
|
@ -158,7 +160,7 @@
|
|||
dragging = false;
|
||||
}
|
||||
|
||||
if (!holding) {
|
||||
if (!holding && !disabled) {
|
||||
dispatch("change", value);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue