ui icon indicating copy to clipboard operation
ui copied to clipboard

Integration between fancybox and tagify fails

Open adonisfigueroa opened this issue 3 years ago • 13 comments

There is a problem using tagify inside a modal opened by fancybox, the option to add tags is not available. In the previous version of fancybox it was possible using the option: data-selectable:

$('.tagify span').attr('data-selectable', true);

But in the new version that option is not available.

I verified that the markup has the option contentEditable: <span contentEditable="true" ... >

If I make a right click, tagify shows the box to write the tag, so looks like the problem is the event to click over some element different to those declared in the code: ["BUTTON","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"]

adonisfigueroa avatar Apr 27 '22 06:04 adonisfigueroa

Hi,

Could you, please, clarify what is tagify, and and maybe you could create a demo where your issue can be observed?

fancyapps avatar Apr 27 '22 06:04 fancyapps

Tagify is a library to work with tags: https://github.com/yairEO/tagify

I'm uploading an example of how to use tagify inside fancybox, as I mentioned in the first post, the problem looks like the event to click over an element, in this case: tags.tagify > span

testTag.zip

adonisfigueroa avatar Apr 27 '22 07:04 adonisfigueroa

Have you tried setting dragToClose:false?

fancyapps avatar May 10 '22 18:05 fancyapps

Yes, it doesn't work, it stopped the drag event but the problem to click elements still persist

adonisfigueroa avatar May 10 '22 22:05 adonisfigueroa

I believe this problem is with Tagify itself. I have created a demo - https://codesandbox.io/s/smoosh-microservice-6s1elt?file=/src/index.js - where I have disabled all touch and focus events of Fancybox. And, as you can see, it only (partially) works after input field is focused (by pressing the tab key).

fancyapps avatar May 11 '22 07:05 fancyapps

I'm not sure if the problem is Tagify because if you run tagify out of Fancybox, it runs correclty, the problem just appears when it's used inside fancybox.

I had a very similar problem using the previous fancybox version 3, but I avoided the problem using this option: $('.tagify span').attr('data-selectable', true);

adonisfigueroa avatar May 27 '22 00:05 adonisfigueroa

So, I created a test page on my PC, copy pasted the code from the demo above ... and it just works perfectly fine. Sorry, but I have no clue what to do here.

fancyapps avatar May 30 '22 13:05 fancyapps

The same problem with many plugins, but if you make the height of the modal window larger so that a scroll appears, then everything works

Nomerokkk avatar Jun 18 '22 15:06 Nomerokkk

@Nomerokkk Please, name at least one of the "many plugins", preferably with a demo.

fancyapps avatar Jun 19 '22 15:06 fancyapps

@fancyapps CKEditor, Select2. The problem, as I understand it, is that focus does not work on elements other than input, textarea. contenteditable tag doesn't help

Nomerokkk avatar Jun 21 '22 08:06 Nomerokkk

Then my guess is that you simply have to set trapFocus : false, otherwise focus will be trapped inside the modal, but these plugins are creating additional elements outside the modal (unless you have configured them).

fancyapps avatar Jun 29 '22 14:06 fancyapps

trapFocus : false doesn`t help, everything works if the height of the modal is greater than the height window

Nomerokkk avatar Jun 29 '22 20:06 Nomerokkk

All elements are configured inside the modal

Nomerokkk avatar Jun 29 '22 20:06 Nomerokkk

I updated previous demo to v5, and it works fine - https://codesandbox.io/s/smoosh-microservice-6s1elt?file=/src/index.js

fancyapps avatar Mar 12 '23 16:03 fancyapps