daybrush / moveable

Moveable! Draggable! Resizable! Scalable! Rotatable! Warpable! Pinchable! Groupable! Snappable!
https://daybrush.com/moveable/
MIT License
10.02k stars 617 forks source link

Focusin and blur events doesn't work on draggable #821

Open MRJCrunch opened 1 year ago

MRJCrunch commented 1 year ago

Environments

Description

I have a case where movable targets have focusin an blur events. If I set draggable property to true these events stop working. Screen Recording 2022-12-20 at 19 24 53

daybrush commented 1 year ago

@MRJCrunch

In draggable, there is a code to preventDefault on mousedown inside moveable. Blur and focus cannot occur.

MRJCrunch commented 1 year ago

@daybrush Is there any workaround to make it work, can you advice something? Component inside movable is 3rd party lib and I can not change events inside it.

daybrush commented 1 year ago

@MRJCrunch

But if preventDefault is not called, selection occurs when dragging. Is it okay?

MRJCrunch commented 1 year ago

@daybrush It is not for some cases. Maybe this behaviour could be configured in options? like preventClickEventOnDrag, but for mousedown

daybrush commented 1 year ago

@MRJCrunch

I will add an option to disable preventDefault in the next version.

jessicalc commented 1 year ago

@MRJCrunch

I will add an option to disable preventDefault in the next version.

Ooh, thank you @daybrush ! I believe the preventDefault: true default behavior may be what's preventing us from upgrading moveable from 0.29.6 to the latest, specifically perhaps this change: https://github.com/daybrush/moveable/blame/706c41c9bd44378e4c3571661d4a90d4b12ab3af/packages/react-moveable/src/gesto/getAbleGesto.ts#L220

daybrush commented 1 year ago

@jessicalc

moveable's new version is released.

preventDefault prop was added. Try it.