Skip to content

Using tags and tokenSeparators cause the last tag to be ignored when pasting a list of tags #5076

@lehmayr

Description

@lehmayr

Steps to reproduce the issue

  1. Init select2 on select[multiple] with tags: true, tokenSeparators: [" "]
  2. Paste a text with some spaces.
  3. All tags except the last one are added directly.
  4. The text of the final tag is entered in the text field. (But the input field width is much too small!)
  5. Press enter.

You can actually test this behavior on the examples page: https://select2.org/tagging#automatic-tokenization-into-tags by pasting this text: red green blue

Expected behavior and actual behavior

Actual: The dropdown opens without any "term" as if the input field was empty.

Expected: I was expecting that it would open the dropdown as if I had entered the text of the final tag.

Environment

Browsers

  • Google Chrome
  • Mozilla Firefox
  • Internet Explorer

Operating System

  • Windows
  • Mac OS X
  • Linux
  • Mobile

Libraries

  • jQuery version: 1.12.4
  • Select2 version: 4.0.4

Isolating the problem

  • This bug happens on the examples page
  • The bug happens consistently across all tested browsers
  • This bug happens when using Select2 without other plugins
  • I can reproduce this bug in a jsbin

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions