drag.validateDrag in my slider is not working

I am new to Babylon. I am using drag.validateDrag to set a boundary to my slider but drag.validateDrag is not working properly . Here is my code:

setupSlider(slider1Center, newMeshs,  5.849, -6.082, onSlider1Change);

function setupSlider(slider, meshes, leftBound, rightBound, onDrag){
let drag = new PointerDragBehavior({dragAxis: new Vector3(1,0,0)});
 slider.addBehavior(drag);
drag.validateDrag = (targetPosition)=>{
    console.log( `target position.x = ${targetPosition.x}`)
      if(targetPosition.x < leftBound){
        slider.position.x = leftBound
      }
      if(targetPosition.x > rightBound){
        slider.position.x = rightBound;
      }
      return true;
  }

Can you repro in the playground?

I am not sure how to do that. I can explain what happening, I am able to slide my slider right and left but it is not stopping on the left bound and right bound. I just want to make sure if my code is correct.

Just copy the relevant code in https://playground.babylonjs.com and copy in this thread the link you get when saving the PG.

Thank you, But I found the solution.

Solution:
drag.validateDrag = (targetPosition)=>{
console.log( target position.x = ${targetPosition.x})
if(targetPosition.x > leftBound){
slider.position.x = leftBound
}
if(targetPosition.x < rightBound){
slider.position.x = rightBound;
}
return true;
}