preventSubmit prop not working
@@ -286,7 +286,7 @@
tags = tags.filter(function (tag) {
var tagDisplayValue = _this2._getTagDisplayValue(tag);
if (typeof tagDisplayValue.trim === 'function') {
- return tagDisplayValue.trim().length > 0;
+ return tagDisplayValue.trim().length >= 0;
} else {
return tagDisplayValue;
}
@@ -351,10 +351,10 @@
value: function accept() {
var tag = this._tag();
- if (tag !== '') {
- tag = this._makeTag(tag);
- return this._addTags([tag]);
- }
+
+ tag = this._makeTag(tag);
+ return this._addTags([tag]);
+
return false;
}
The preventSubmit prop is not working if set to false. By making the above hacky fix it works. I have provided the diff of the changed code.
It was my PR that introduced this prop - I still perhaps think the prop name isn't the best - however it was written to maintain the default behaviour (the props default setting is false). https://github.com/olahol/react-tagsinput/pull/135
Could you possibly describe the behaviour you're experiencing, there are also some tests backing this prop up if you could potentially add a failing one I'd be happy to try and take a look https://github.com/olahol/react-tagsinput/blob/master/test/index.js#L522
@ryanhyslop Sorry for the delayed response. I have added a failing test and the fix. Can you please check https://github.com/olahol/react-tagsinput/pull/168 I agree that the prop name can be better something like allowEmptyTag ? what do you think ?
@ryanhyslop any updates ?