From 251ff67a40960f902a159eb18b49430135d17c32 Mon Sep 17 00:00:00 2001 From: Vitaly Rtishchev Date: Fri, 10 May 2024 09:24:46 +0400 Subject: [PATCH] [@mantine/core] Rating: Fix `readOnly` prop now working on touch devices (#6202) --- packages/@mantine/core/src/components/Rating/Rating.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/@mantine/core/src/components/Rating/Rating.tsx b/packages/@mantine/core/src/components/Rating/Rating.tsx index 0b6b232d81..c50a30efb1 100644 --- a/packages/@mantine/core/src/components/Rating/Rating.tsx +++ b/packages/@mantine/core/src/components/Rating/Rating.tsx @@ -217,15 +217,15 @@ export const Rating = factory((_props, ref) => { }; const handleTouchStart = (event: React.TouchEvent) => { - event.preventDefault(); - const { touches } = event; if (touches.length !== 1) { return; } - const touch = touches[0]; - setValue(getRatingFromCoordinates(touch.clientX)); + if (!readOnly) { + const touch = touches[0]; + setValue(getRatingFromCoordinates(touch.clientX)); + } onTouchStart?.(event); };