Yoast / ui-library-storybook

1 stars 1 forks source link

Support for Space as separator in InputTag as prop #2

Open vraja-pro opened 1 year ago

vraja-pro commented 1 year ago

In Additional URL parameters to allow space should not be allowed. Should auto-create tags when you hit space, as URL parameters/keys won't/can't ever have space characters in them.

Connected to issue #317

Image

d-claassen commented 10 months ago

Making the list of separators dynamic sounds like a good idea. If someone wants to allow commas in their tag, they'll also want to configure that.

An option to prevent adding spaces in a tag would be to make the component support more generic validation. Pass an actual Event instance to the onAddTag and onRemoveTag handlers of the component. Set the value of those events to the text of the tag value. Then support the event.preventDefault() function being called by returning early if we see that event.isDefaultPrevent() is set to true.