Fix remaining known Svelte UI regressions

Closes #1040
This commit is contained in:
Keavon Chambers
2023-03-20 21:26:33 -07:00
parent 9c10d18308
commit bfbabbc4dc
17 changed files with 62 additions and 69 deletions
@@ -64,9 +64,10 @@
// "dragging": the user is dragging the slider left/right.
let rangeSliderClickDragState: "default" | "mousedown" | "dragging" = "default";
$: sliderStepValue = isInteger ? (step === undefined ? 1 : step) : "any";
$: watchValue(value);
$: sliderStepValue = isInteger ? (step === undefined ? 1 : step) : "any";
// Called only when `value` is changed from outside this component
function watchValue(value: number | undefined) {
// Don't update if the slider is currently being dragged (we don't want the backend fighting with the user's drag)
@@ -130,7 +131,7 @@
function onSliderPointerUp() {
// User clicked but didn't drag, so we focus the text input element
if (rangeSliderClickDragState === "mousedown") {
const inputElement = self?.element()?.querySelector("[data-input-element]") as HTMLInputElement | undefined;
const inputElement = self?.element();
if (!inputElement) return;
// Set the slider position back to the original position to undo the user moving it