@@ -731,10 +731,7 @@ function SliderThumb(props: ScopedProps<SliderThumbProps>): FictNode {
731731 const dimension = size ( ) ?. [ orientation . size ( ) ]
732732 return dimension ? getThumbInBoundsOffset ( dimension , percent ( ) , orientation . direction ( ) ) : 0
733733 }
734- const isFormControl = ( ) => {
735- const thumbNode = thumb ( )
736- return thumbNode ? Boolean ( context . form ( ) || thumbNode . closest ( 'form' ) ) : true
737- }
734+ const isFormControl = createSignal ( false )
738735 const label = ( ) => getLabel ( index ( ) , context . values ( ) . length )
739736 const wrapperStyle = ( ) => ( {
740737 transform : 'var(--radix-slider-thumb-transform)' ,
@@ -773,28 +770,31 @@ function SliderThumb(props: ScopedProps<SliderThumbProps>): FictNode {
773770 const thumbNode = thumb ( )
774771 if ( ! thumbNode ) return
775772
773+ isFormControl ( Boolean ( context . form ( ) || thumbNode . closest ( 'form' ) ) )
776774 context . thumbs . add ( thumbNode )
777775 return ( ) => {
776+ isFormControl ( false )
778777 context . thumbs . delete ( thumbNode )
779778 }
780779 } )
781780
782- const bubbleInputNode = ( isFormControl ( ) ? (
783- < SliderBubbleInput
784- __scopeSlider = { props . __scopeSlider }
785- name = { ( ) => {
786- const itemName =
787- props . name === undefined
788- ? context . name ( )
789- : readValue ( props . name as MaybeAccessor < string | undefined > )
790-
791- if ( ! itemName ) return undefined
792- return context . values ( ) . length > 1 ? `${ itemName } []` : itemName
793- } }
794- form = { context . form }
795- value = { value }
796- />
797- ) : null ) as unknown as FictNode
781+ const bubbleInputNode = ( ( ) =>
782+ isFormControl ( ) ? (
783+ < SliderBubbleInput
784+ __scopeSlider = { props . __scopeSlider }
785+ name = { ( ) => {
786+ const itemName =
787+ props . name === undefined
788+ ? context . name ( )
789+ : readValue ( props . name as MaybeAccessor < string | undefined > )
790+
791+ if ( ! itemName ) return undefined
792+ return context . values ( ) . length > 1 ? `${ itemName } []` : itemName
793+ } }
794+ form = { context . form }
795+ value = { value }
796+ />
797+ ) : null ) as unknown as FictNode
798798
799799 return (
800800 < span style = { wrapperStyle ( ) } >
@@ -823,28 +823,28 @@ function SliderBubbleInput(props: ScopedProps<SliderBubbleInputProps>): FictNode
823823 const input = ref ( )
824824 const nextValue = readValue ( props . value )
825825 const prevValue = previousValue ( )
826+ const nextValueString = nextValue === undefined ? '' : String ( nextValue )
826827
827828 if ( ! input ) return
828829
829- if ( ! Object . is ( prevValue , nextValue ) ) {
830- const descriptor = Object . getOwnPropertyDescriptor ( window . HTMLInputElement . prototype , 'value' )
831- const setValue = descriptor ?. set
830+ const descriptor = Object . getOwnPropertyDescriptor ( window . HTMLInputElement . prototype , 'value' )
831+ const setValue = descriptor ?. set
832+ if ( input . value !== nextValueString ) {
832833 if ( setValue ) {
833- setValue . call ( input , nextValue === undefined ? '' : String ( nextValue ) )
834+ setValue . call ( input , nextValueString )
834835 } else {
835- input . value = nextValue === undefined ? '' : String ( nextValue )
836+ input . value = nextValueString
836837 }
838+ }
837839
840+ if ( ! Object . is ( prevValue , nextValue ) ) {
838841 input . dispatchEvent ( new Event ( 'input' , { bubbles : true } ) )
839842 }
840843 } )
841844
842845 const inputProps = mergeProps ( ( ) => inputRestProps as Record < string , unknown > , {
843846 __scopeSlider : undefined ,
844- defaultValue : prop ( ( ) => {
845- const nextValue = readValue ( props . value )
846- return nextValue === undefined ? '' : String ( nextValue )
847- } ) ,
847+ defaultValue : undefined ,
848848 'attr:form' : prop ( ( ) =>
849849 formProp === undefined ? undefined : readValue ( formProp as MaybeAccessor < string | undefined > ) ,
850850 ) ,
@@ -858,7 +858,10 @@ function SliderBubbleInput(props: ScopedProps<SliderBubbleInputProps>): FictNode
858858 display : 'none' ,
859859 ...readStyle ( props . style ) ,
860860 } ) ) ,
861- value : undefined ,
861+ value : prop ( ( ) => {
862+ const nextValue = readValue ( props . value )
863+ return nextValue === undefined ? '' : String ( nextValue )
864+ } ) ,
862865 } )
863866
864867 return (
0 commit comments