Skip to content

[5.x]: Repeatedly clicking add-button in matrix generates multiple blocks, disregarding max-block setting #16642

@sandrodunkel

Description

@sandrodunkel

What happened?

Description

I have a matrix with only one entry type and a max block setting of 1. When creating a block, it is possible to click the add-button several times very quickly, resulting 4-5 blocks, even though the max block setting of the matrix field is set to 1 and does not allow this many blocks.

After one click, the field should already recognise that I have created a block and, since the max block setting is set to 1, prevent me from adding another one. Alternatively, if that is not possible, maybe the user should not be able to add multiple blocks at a time. Meaning that when the user clicks on "add", that the button gets disabled until the block is fully being created and only then can a user add another one.

Steps to reproduce

  1. Create matrix field with one entry type and a max block setting of 1.
  2. in a new entry, click on the add-block-button multiple times very quickly. Click number 2,3,4,… need to be before click 1 has successfully added the block.

Expected behavior

Since the max block setting is set to 1, only one block is being created.

Actual behavior

Multiple blocks are being created, preventing me from saving the entry and forcing me to delete all blocks manually.

Craft CMS version

5.6.4

PHP version

8.3.15

Operating system and version

No response

Database type and version

MariaDB 10.11.10

Image driver and version

No response

Installed plugins and versions

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions