tagify icon indicating copy to clipboard operation
tagify copied to clipboard

Allow changing the placeholder after initialization

Open yairEO opened this issue 4 years ago • 11 comments

Currently the placeholder is being applied via the wrapper template, once the Tagify instance has been created, and cannot be changed afterwards.

I suggest adding a method (on the Tagify instance) for setting the placeholder

yairEO avatar Jul 07 '20 20:07 yairEO

Currently it can be changed by:

tagify.DOM.input.setAttribute('data-placeholder', 'type some tags')

yairEO avatar Jul 17 '20 20:07 yairEO

Thanks for this tip it was very useful. I used it to auto-hide the placeholder when there is content within the input. A default auto hide feature for the place holder would be a great addition too

Thanks for this amazing library

adrienpoly avatar Jan 21 '21 05:01 adrienpoly

Thank you, but I don't understand anything of what you've said.. could you put here a video of the problem, or at least steps to reproduce?

yairEO avatar Jan 28 '21 20:01 yairEO

It would be great to have the ability to auto-hide the placeholder when one or more tags have been selected and then show it again when all the tags have been removed. Currently, we are achieving this by hooking to the change event but it would be good to have a Tagify setting to do this automatically.

jasonhill avatar Jun 29 '21 02:06 jasonhill

@jasonhill - this can and should be done with a simple CSS by the developer who implements Tagify

It's not a javascript-thing

yairEO avatar Jun 30 '21 12:06 yairEO

It feels like something that should also be part of the component. Inputs hide the placeholder once there is a value present so Tagify is operating differently to standard inputs. A simple configuration flag to hide the placeholder when the tags are not empty would be convenient.

On Wed, 30 Jun 2021 at 22:37, Yair Even Or @.***> wrote:

@jasonhill https://github.com/jasonhill - this can and should be done with a simple CSS by the developer who implements Tagify

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/yairEO/tagify/issues/562#issuecomment-871365800, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKDZDZ2O2XBKGYOL4UA76DTVMFZNANCNFSM4OTPYU6A .

jasonhill avatar Jun 30 '21 22:06 jasonhill

A simple configuration flag to hide the placeholder when the tags are not empty would be convenient.

@jasonhill - what is the difference between typing the code for that configuration and typing the CSS code to hide it? it's the same development effort and approximately same amount of code

Tagify already has many configurable settings and I don't want to make a new setting for every little thing a developer can easily customize by him/her-self.

I've built the code in such high flexibility to allow developers to customize everything easily without me having to manually write a setting for every scenario

I only write settings which are popular/trivial and/or too complex to achieve by local customization. CSS customization should not be something to avoid :)

yairEO avatar Jul 03 '21 20:07 yairEO

Ok…we will use css then. I still find it strange that the placeholder default behaviour isn’t the same as regular placeholders though.

On 4 Jul 2021, at 6:44 am, Yair Even Or @.***> wrote:

 A simple configuration flag to hide the placeholder when the tags are not empty would be convenient.

@jasonhill - what is the difference between typing the code for that configuration and typing the CSS code to hide it? it's the same development effort and approximately same amount of code

Tagify already has many configurable settings and I don't want to make a new setting for every little thing a developer can easily customize by him/her-self.

I've built the code in such high flexibility to allow developers to customize everything easily without me having to manually write a setting for every scenario

I only write settings which are popular/trivial and/or too complex to achieve by local customization. CSS customization should not be something to avoid :)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

jasonhill avatar Jul 03 '21 21:07 jasonhill

@jasonhill - I understand what you are saying as it seems different than default built-in inputs, but those has a single value, and there is no real comparable native-browser input with both placeholder and multi-selection, so I simply wrote the default behavior as what seemed to me as logical, because I want to signal users where can they click to start typing, and a placeholder achieves this.

A "regular" (text) input, for example, can be clicked anywhere inside, but tagify is more complex. clicking/double-clicking tags trigger a whole flow of events which are different from clicking the "input" area where the placeholder is located.

If I remove the placeholder for Tagify components which already has tags, and lets assume the user is unfamiliar with Tagify and he/she where not the ones that added these tags in the first place, then the user might be unsure it they can add tags or where to click to do that, so I just wanted to eliminate any such uncertainty.

yairEO avatar Jul 05 '21 15:07 yairEO

I mean, I completely agree with jasonhill. This is a huge oversight and should be addressed.

tsegreto avatar Aug 25 '21 06:08 tsegreto

@tsegreto - How is this huge if you can easily define this in your CSS:

.tagify__tag + .tagify__input::before{ opacity:0; }

Or this

.tagify:not(.tagify--noTags){
  --placeholder-color: transparent;
  --placeholder-color-focus: transparent;
}

yairEO avatar Aug 25 '21 12:08 yairEO