GSAP icon indicating copy to clipboard operation
GSAP copied to clipboard

Draggable doesn't allow text fields to be blurred

Open ccocks opened this issue 1 year ago • 6 comments

Draggable doesn't allow text fields to be focused: https://codepen.io/BlazgoCompany/pen/oNrBJOm To focus the textbox, you have to click the textbox multiple times. To unfocus, you have to either:

  1. Click the draggable container multiple times, or,
  2. Click outside the draggable container once.

There is a text cursor on hover, and minimumMovement is 100 so there is no problem with that either.

ccocks avatar Jul 31 '24 15:07 ccocks

@jackdoyle Is there a way to fix this

ccocks avatar Jul 31 '24 16:07 ccocks

I’m not at my computer at the moment, but have you tried adding:

dragClickables: false

jackdoyle avatar Aug 01 '24 04:08 jackdoyle

Thank you, dragClickables: true works However, I still have to click on .container multiple times in order to blur the box

ccocks avatar Aug 01 '24 16:08 ccocks

@jackdoyle, Any updates on this?

ccocks avatar Aug 14 '24 21:08 ccocks

Draggable.create(".container", { dragClickables: false, onClick: function(event){ if(event.target.id !== "dur") { document.querySelector("#dur").blur() } } })

You can use this

lovepreet-singh123 avatar Oct 13 '25 09:10 lovepreet-singh123

Actually, here's a more generic solution that doesn't depend on specific IDs:

onClick(e) {
  let lastTarget = this.releaseTarget,
      newTarget = e.target;
  lastTarget && lastTarget !== newTarget && lastTarget.blur && lastTarget.blur();
  this.releaseTarget = newTarget;
}

jackdoyle avatar Oct 13 '25 19:10 jackdoyle