tagify icon indicating copy to clipboard operation
tagify copied to clipboard

Method to blur Tagify

Open wurst-hans opened this issue 8 months ago • 2 comments

I'm using Tagify in select mode (i.e. as dropdown) very often. Currently, I have a special requirement: When a value from dropdown has been selected, then the Tagify object should be resetted and blurred. The reset is not a problem using an event listener:

tagify.on('dropdown:hide', function (event) {
    tagify.removeTags();
});

But I haven't found an option to blur the whole object, it still has focus. See Fiddle also. If you are wondering, what I want to achieve: I just need to get the selected value in dropdown:select event, which works fine, and have to reset the Tagify afterwards.

wurst-hans avatar Apr 15 '25 15:04 wurst-hans

I don't understand what is this term you keep saying: "reset". what does that actually mean? why would you remove the selected option once it is selected? why would you do this on the dropdown:hide event?

yairEO avatar Apr 16 '25 17:04 yairEO

I use the dropdown only to trigger some other actions in Javascript (I use it as a kind of navigation). How does that work currently:

  • the Tagify (i.e. INPUT) has no initial value
  • on opening the dropdown, the user can choose an entry and via dropdown:select I trigger a custom action
  • now, I want the Tagify to revert to the initial state (i.e. it has no value or tags and looses focus)

I know this is a very specific requirement. I just wanted to know, if there is a clean way to get this working. The dropdown:hide was my first guess to place a removeTags() but it still has focus (blue highlighted border), which I'm not able to remove. If this is too specific for Tagify, then just close this, no problem.

wurst-hans avatar Apr 18 '25 12:04 wurst-hans