Skip to content

Conversation

@Snake707
Copy link

Description

Fixed the bug #1345

See there on how to reproduce.

Types of changes

  • Chore (tooling change or documentation change)
  • Refactor (non-breaking change which maintains existing functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • My code follows the code style of this project.
  • I have added new tests for the bug I fixed/the new feature I added.
  • I have modified existing tests for the bug I fixed/the new feature I added.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
@Xon
Copy link
Collaborator

Xon commented Sep 4, 2025

This change does not account for select-single mode where this feature isn't desirable

@Xon Xon added the changes required Pull request requires changes before it can be merged label Sep 4, 2025
@Snake707
Copy link
Author

Snake707 commented Sep 5, 2025

Hi @Xon,

I thought I manually checked that behaviour. So I checked it again:

As long as addChoices is deactivated, single-select earlies out in _onEnterKey for some reason:

  • Either the highlightedChoice is available,
  • or the target or value being null (target is an empty object).
  • Otherwise it will enter out if the this._canAddUserChoice is false.

If the user can add choices:

  • Firstly, the load choices bug on which this change request is based will apply.
  • Secondly, adding multiple - delimiter separated - entries will add multiple choices and select the last choice in single-selects.
  • Thirdly, In multi-selects it will add all generated choices.
  • Lastly, in text it will also make several bubbles.

Personally I would find this behavior acceptable.

Since the documentation only specifies the delimiter behavior working on text and not on multi-selects I would need your guidance as to what should be accomplished. Our use case with choices-js is having such ability with multi-selects (copying and pasting).

Do you need more tests?

Kind Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changes required Pull request requires changes before it can be merged

2 participants