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 Slider from "./Slider.svelte";
|
||||||
import SliderSkeleton from "./Slider.Skeleton.svelte";
|
import SliderSkeleton from "./Slider.Skeleton.svelte";
|
||||||
|
|
||||||
$: value = 50;
|
let value = 50;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if story === 'skeleton'}
|
{#if story === 'skeleton'}
|
||||||
|
|
|
@ -129,6 +129,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function calcValue(e) {
|
function calcValue(e) {
|
||||||
|
if (disabled) return;
|
||||||
|
|
||||||
const offsetX = e.touches ? e.touches[0].clientX : e.clientX;
|
const offsetX = e.touches ? e.touches[0].clientX : e.clientX;
|
||||||
const { left, width } = trackRef.getBoundingClientRect();
|
const { left, width } = trackRef.getBoundingClientRect();
|
||||||
let nextValue =
|
let nextValue =
|
||||||
|
@ -158,7 +160,7 @@
|
||||||
dragging = false;
|
dragging = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!holding) {
|
if (!holding && !disabled) {
|
||||||
dispatch("change", value);
|
dispatch("change", value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue