TeamWertarbyte / material-ui-chip-input

A chip input field using Material-UI.
https://mui.wertarbyte.com/#material-ui-chip-input
MIT License
737 stars 208 forks source link

Form submission should be prevented of onBeforeAdd prevented chip creation #327

Open theKashey opened 4 years ago

theKashey commented 4 years ago

Scenario

I am referring to this piece of code: https://github.com/TeamWertarbyte/material-ui-chip-input/blob/master/src/ChipInput.js#L391-L394

should be

 handleAddChip (chip) {
    if (this.props.onBeforeAdd && !this.props.onBeforeAdd(chip)) {
      this._preventChipCreation = true
      return chip ? true : false; // -> allow default only if there is no chip to add
    }
leMaik commented 4 years ago

Good suggestion, PR welcome @theKashey :)

ghost commented 3 years ago

Hi guys, is it ok if I open this PR since it's inactive since September 2020? I'm really needing this fix. Thank you.