i-like-robots/react-tags

Comma delimiter does not work

richardARPANET opened this issue · 1 comments

Example

const delimiters = ['Comma', 'Enter', 'Tab']

...
    render() {
        return (
            <ReactTags
                classNames={
                    {
                        root: 'react-tags form-control h-auto',
                        searchInput: '',
                    }
                }
                delimiters={delimiters}
                allowNew={true}
                addOnBlur={true}
                minQueryLength={2}
                placeholderText="Add Tag"
                ref={this.reactTags}
                tags={this.state.tags}
                suggestions={this.state.suggestions}
                onDelete={this.onDelete.bind(this)}
                onAddition={this.onAddition.bind(this)} />
        )
    }

Tab and Enter works, however when Comma key is pressed, nothing happens.

The delimiters option expects KeyboardEvent.key values, so you need "," rather than "Comma" which is a KeyboardEvent.code value.

cc #233 and #213