Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.x][5.x]: Unable to expand/collapse entry/category in field element select modal if descendant already selected for field #15337

Closed
ttempleton opened this issue Jul 12, 2024 · 2 comments
Labels

Comments

@ttempleton
Copy link

What happened?

Description

When a descendant element is set to a categories field, or an entries field set to maintain hierarchy, the element's ancestors can't be expanded or collapsed in the element select modal. This creates a problem if the ancestor is stuck as collapsed (which can happen if it was collapsed when the field was used in a different context where the ancestor was collapsible), since no other descendants can then be selected for the field.

Steps to reproduce

  1. Fresh Craft install
  2. Create a new new category group, or structure section, with no level limit
  3. In the above group/section, create one level 1 element (named L1) with two child elements (named L2A and L2B)
  4. Create a categories or entries field with the above group/section as its only source, set to maintain hierarchy, no limit on selectable branches
  5. Create a channel section (and entry type on Craft 5), and add the above field to the entry type field layout
  6. Create an entry in the channel, add element L2A to the above field
  7. Try to add another element to the field, and note that element L1 cannot be collapsed
  8. Create another entry in the channel, click to add an element to the field, collapse element L1 and exit
  9. Go back to the first entry in the channel, click to add an element to the field, and note that element L1 cannot be expanded, making it impossible to select element L2B

Expected behavior

Category/entry could be expanded/collapsed regardless of any descendant elements being selected for the field already

Actual behavior

Category/entry can't be expanded/collapsed

Craft CMS version

4.10.5 / 5.2.6

PHP version

No response

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

None

@ttempleton ttempleton added the bug label Jul 12, 2024
brandonkelly added a commit that referenced this issue Jul 14, 2024
@brandonkelly
Copy link
Member

Thanks for reporting that! Fixed for the next Craft 4 and 5 releases.

@brandonkelly
Copy link
Member

Craft 4.10.6 and 5.2.7 are out now with that fix. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants