From bc674346aa07845250705e5db395e6f5b20547c1 Mon Sep 17 00:00:00 2001 From: Alan Trebugeais Date: Sun, 10 May 2026 00:31:04 +0200 Subject: [PATCH] fix problems called out by CodeRabbits --- src/components/video-editor/SliderControl.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/components/video-editor/SliderControl.tsx b/src/components/video-editor/SliderControl.tsx index 3de99ed7..25a1c145 100644 --- a/src/components/video-editor/SliderControl.tsx +++ b/src/components/video-editor/SliderControl.tsx @@ -69,11 +69,13 @@ export const SliderControl = memo(function SliderControl({ const rawValue = min + normalized * (max - min); const nextValue = clamp(quantizeToStep(rawValue, min, step), min, max); const finalValue = Number(nextValue.toFixed(6)); - const currentPct = (normalized * 100).toFixed(4); + const finalPct = (((finalValue - min) / (max - min || 1)) * 100).toFixed(4); // Direct DOM update for instant feedback if (rootRef.current) { - rootRef.current.style.setProperty("--slider-pct", `${currentPct}%`); + rootRef.current.style.setProperty("--slider-pct", `${finalPct}%`); + rootRef.current.setAttribute("aria-valuenow", String(finalValue)); + rootRef.current.setAttribute("aria-valuetext", formatValue(finalValue)); } if (valueTextRef.current) { valueTextRef.current.textContent = formatValue(finalValue); @@ -118,6 +120,11 @@ export const SliderControl = memo(function SliderControl({ if (requestRef.current) { cancelAnimationFrame(requestRef.current); + requestRef.current = null; + } + + if (finishEvent.type === "pointerup") { + updateValue(finishEvent.clientX); } target.releasePointerCapture(pointerId);