From 6a3d7c7247f74e21a8377676daf228822f879b26 Mon Sep 17 00:00:00 2001 From: Sean Perkins <13732623+sean-perkins@users.noreply.github.com> Date: Fri, 30 Aug 2024 13:06:46 -0400 Subject: [PATCH] fix(range): emit correct value when knob is at start of bar (#29820) Issue number: resolves #29792 --------- ## What is the current behavior? When the user drags the range knob (most easily reproduced in fullscreen mode) and the gesture emits a current x position of `0`, the range incorrectly emits a value of `NaN`. ## What is the new behavior? - `ion-range` does not emit `NaN` and instead emits the correct range value for the knob ## Does this introduce a breaking change? - [ ] Yes - [ ] No ## Other information --- core/src/components/range/range.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/components/range/range.tsx b/core/src/components/range/range.tsx index 0ca33f6ca1..baccd1f985 100644 --- a/core/src/components/range/range.tsx +++ b/core/src/components/range/range.tsx @@ -449,7 +449,7 @@ export class Range implements ComponentInterface { */ private onEnd(detail: GestureDetail | MouseEvent) { const { contentEl, initialContentScrollY } = this; - const currentX = (detail as GestureDetail).currentX || (detail as MouseEvent).clientX; + const currentX = (detail as GestureDetail).currentX ?? (detail as MouseEvent).clientX; /** * The `pressedKnob` can be undefined if the user never