Skip to content

Commit

Permalink
OPHJOD-292: Update id&name of the Slider's input
Browse files Browse the repository at this point in the history
  • Loading branch information
ketsappi committed Apr 29, 2024
1 parent 57c1e22 commit 39c12f8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/components/Slider/Slider.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useRef, useState } from 'react';
import { useId, useRef, useState } from 'react';
import {
Slider as ArkSlider,
SliderValueChangeDetails as ArkValueChangeDetails,
Expand Down Expand Up @@ -50,6 +50,7 @@ const getThumbBackgroundColor = (focused: boolean, value: number) => {
};

export const Slider = ({ label, icon, onValueChange, value }: SliderProps) => {
const inputId = useId();
const [focused, setFocused] = useState(false);
const arrowRef = useRef(null);
const { refs, floatingStyles, context } = useFloating({
Expand Down Expand Up @@ -94,6 +95,8 @@ export const Slider = ({ label, icon, onValueChange, value }: SliderProps) => {
<span className="flex items-center justify-center text-[37px]">{icon}</span>
</span>
<ArkSlider.Root
id={inputId}
name={`slider-${inputId}`}
className="ml-3 mr-5 flex grow flex-col justify-center"
onValueChange={onValueChangeHandler}
onFocusChange={onFocusChangeHandler}
Expand Down

0 comments on commit 39c12f8

Please sign in to comment.