What happened?
Description
If a category field already has a value selected, and an editor then opens the "Add category" modal and chooses any category, the original value is overwritten. In Craft 4 and prior, the overwrite would only occur if the category field was set to only allow one value. If a one-to-many relationship is allowed, the categories would be added to the existing list.
This may be related, so I'll mention it here as well, but the same issue occurs within the modal when searching, so you cannot make multiple searches to find different categories, as each search deselects previous selections.
Steps to reproduce
- Create a category field with no restrictions on number of relationships and implement this on an entry type.
- Add a category on an entry of the relevant type and save.
- Reopen the entry, press the "Add category" button, select any other category, and press Select.
For the secondary issue:
- Reopen the entry, press the "Add category" button, select any category.
- Now search for any other category within the modal's search input. Select any returned category.
- Press Select.
Expected behavior
Both the originally selected category and new category should be present.
For the secondary issue: both selected categories should now be present (the one selected prior to searching, and the one selected after).
Actual behavior
Original category is removed and only the new category is now visible.
Secondary issue: only the latter will be present.
Craft CMS version
5.0.4
PHP version
8.2.18
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
What happened?
Description
If a category field already has a value selected, and an editor then opens the "Add category" modal and chooses any category, the original value is overwritten. In Craft 4 and prior, the overwrite would only occur if the category field was set to only allow one value. If a one-to-many relationship is allowed, the categories would be added to the existing list.
This may be related, so I'll mention it here as well, but the same issue occurs within the modal when searching, so you cannot make multiple searches to find different categories, as each search deselects previous selections.
Steps to reproduce
For the secondary issue:
Expected behavior
Both the originally selected category and new category should be present.
For the secondary issue: both selected categories should now be present (the one selected prior to searching, and the one selected after).
Actual behavior
Original category is removed and only the new category is now visible.
Secondary issue: only the latter will be present.
Craft CMS version
5.0.4
PHP version
8.2.18
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions