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]: Field layout deletes empty tabs on save #13132

Closed
ccchapman opened this issue Apr 27, 2023 · 6 comments
Closed

[4.x]: Field layout deletes empty tabs on save #13132

ccchapman opened this issue Apr 27, 2023 · 6 comments

Comments

@ccchapman
Copy link
Contributor

ccchapman commented Apr 27, 2023

What happened?

Description

When saving an entry type, tabs without elements are lost.

I often find myself creating a bunch of empty tabs to scaffold an entry type. It is frustrating that the tabs are irrecoverably lost.

Steps to reproduce

  1. Edit an entry type
  2. Add a new tab without elements
  3. Click save

Expected behavior

Empty tab is not lost. This could mean that the tab shows a validation error ("Tabs must have at least one element.") or empty tabs are persisted without error.

Actual behavior

Empty tab is lost.

Craft CMS version

4.4.8

PHP version

8.2

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

@brandonkelly
Copy link
Member

This is currently working as intended. Why create a tab you’re intentionally leaving blank?

@ccchapman
Copy link
Contributor Author

This is currently working as intended. Why create a tab you’re intentionally leaving blank?

If I am creating an entry type, I often create a bunch of blank tabs to scaffold how the entry type should look. If you instinctively save the entry type before populating the elements on the tab, those tabs disappear with no recourse.

@brandonkelly
Copy link
Member

Yeah, there is some code in place that is intentionally removing unneeded tabs. We can discuss internally whether it makes sense to remove that.

@ccchapman
Copy link
Contributor Author

ccchapman commented Apr 28, 2023

Yeah, there is some code in place that is intentionally removing unneeded tabs. We can discuss internally whether it makes sense to remove that.

👍

There are some situations where you might expect this behavior. Like if the tab is preexisting and you remove all elements from it.

I personally might lean towards having a double-confirm ("You are saving a field layout with blank tabs. Blank tabs will be removed. Continue?") Maybe not a common convention in Craft but somewhat similar to the popup when deleting a user. Avoids a potential jarring and frustrating UX with some warning to the user.

@brandonkelly
Copy link
Member

I think if anything we would just stop removing them. It’s not a huge deal either way because blank tabs don’t get included in element editors (e.g. if all the fields within them are hidden due to conditions).

@brandonkelly
Copy link
Member

Craft 4.5.0 is out with this change!

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

No branches or pull requests

2 participants