Skip to content

nz-select nzMaxMultipleCount+nzTokenSeparators bug: It can select options that are greater than its limit when pasting values #9078

Closed
@andy2208070

Description

@andy2208070

Reproduction link

https://stackblitz.com/edit/nfh233wt

Steps to reproduce

  1. Create a nz-select component,
    • set nzMode to 'tags',
    • set nzMaxMultipleCount to 2,
    • set nzTokenSeparators to [','],
    • configure at least 3 nzOptions, and
    • set the variable for the component's value.
     <nz-select
       [(ngModel)]="listOfTagOptions"
       nzMode="tags"
       [nzTokenSeparators]="[',']"
       [nzMaxMultipleCount]="2"
     >
       @for (option of listOfOption; track option.value) {
         <nz-option [nzLabel]="option.label" [nzValue]="option.value"></nz-option>
       }
     </nz-select>
  2. Copy at least three options to your clipboard, separated by commas, such as a10, b11, c12
  3. Paste the values into the nz-select field
    Image

What is expected?

nz-select should limit the number of options that can be pasted

What is actually happening?

nz-select does not limit the number of options that can be pasted

Environment Info
ng-zorro-antd 18.2.1
Browser chrome

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions