vue-tags-input icon indicating copy to clipboard operation
vue-tags-input copied to clipboard

FEAT Customization of the input field (type, autocomplete)

Open abasille opened this issue 5 years ago • 1 comments

Why?

  • The browser can autofill the input field with non-relevant suggestions (e.g. an address suggestion).

Peek 05-05-2020 17-00

  • On a mobile device, the default keyboard is displayed whereas we could want a number one or an email keyboard (see #68 ).

  • At least one dev wants to hide the input field when maxTags is reached #115 .

Possible solutions

Sol#1 — Add props to set HTML attributes of the input field

  • autocomplete: with a random value, we could disable the browser autofill feature.
  • type: 'email', 'number' according to the HTML specs.
  • ...all other useful props

Sol#2 — Add a slot to override the default input field

Full-control for the developer.

Preferred solution

For me Sol#2 is the better choice. It brings freedom to the developer.

@JohMun I would like your opinion before coding a PR. Are you still maintain this package? Do you need some help?

abasille avatar May 05 '20 15:05 abasille

Sol#3 (partial solution)

Since v-bind="$attrs" is passed to the input component, attributes different than class, style, type or size can simply be passed to vue-tags-input:

https://github.com/JohMun/vue-tags-input/blob/32b8f552eaf2eb477b2c97d69a0af5b7ddcb94fc/vue-tags-input/vue-tags-input.vue#L122-L145

Example:

<vue-tags-input
  [...]
  :autocomplete="new Date().getTime()"
/>

will disable the browser autofill feature.

Drawbacks

The attribute type cannot be overriden.

abasille avatar May 18 '20 17:05 abasille