moveable icon indicating copy to clipboard operation
moveable copied to clipboard

On drag/resize/rotate moveable element, doesn't trigger blur event

Open chenxeed opened this issue 2 years ago • 1 comments

Environments

  • Framework name: ?
  • Framework version: ?
  • Moveable Component version: 0.26.0
  • Testable Address(optional): https://daybrush.com/moveable/storybook/?path=/story/nested-transform--draggable

Description

In my situation, I need to make sure that the drag/resize/rotate event is updating the focus to the targetted element as well, or at least blur the activeElement to the body.

I can replicate this as well on the storybook demo:

You may notice the focus on the input doesn't blurred when we're dragging the element.

What makes me wonder was, the blur event does triggered properly if I'm trying to replicate this on the demo page (https://daybrush.com/moveable/).

I would like to know if it's intended, and how can I make sure the blur event is still triggered like the demo page?

Thank you so much!

chenxeed avatar Oct 07 '21 05:10 chenxeed

@chenxeed It's a little different from the demo code. Since the storybook is separated from the iframe, would you like to use the code below?

      onDragStart={e => {
        const activeElement = document.activeElement;
        if (!activeElement) {
             // focus iframe
             return false;
        }
}}

daybrush avatar Oct 31 '21 11:10 daybrush