Background

Nested paragraphs are important but have difficult UX. In #2642810: UX improvements for nested paragraphs we have discussed intensively and developed UX improvements that can be achieved by tweaking visual appearance alone.

A vital feature for nested paragraphs is the default edit mode set in the paragraphs form widget: "Open", "Closed" or "Preview", and the corresponding actions to "Edit" or "Collapse" paragraphs.

These actions are so vital to working with deeply nested paragraphs, that they should always be available. Obviously, one always needs to be able to activate "Edit"; but it's enormously helpful to also always have the option to "Preview" or "Close" a paragraph type. For example, "closed" is the right mode for rearranging the sequence of items, while "preview" is often a better default choice.

Problem

At the moment this doesn't happen for 2 reasons:

Firstly, in certain nested circumstances, the collapse button action does not appear, and while we can click "Edit" to expand a paragraph, that cannot be reversed. See this for an example - the para type "Body text" in the paragraphs field "Left" has been expanded by "Edit", and now no collapse action is visible. This looks like a bug.

Secondly, the availability of the three actions depends on what you set for the default mode. If the sitebuilder selects Open as the default mode as the default, then a content editor can never close or preview paragraphs. If Preview is the default, then you can never close paras, and if Closed is the default then you can never preview.

Solution

The simplest solutions is the most powerful and flexible: whichever mode a paragraph is currently in, regardless of the default, have the actions to enter the other 2 modes available.

There's a lot of room to discuss what sequence these actions should be in - in particular what is the topmost action, thoe one that shows on the face of the actions dropbutton. I would suggest:

currentMode=closed then actions={Edit, Preview, Remove}
currentMode=preview then actions={Edit, Close, Remove}
currentMode=open&default=closed then actions={Close,Preview, Remove}
currentMode=open&default=preview then actions={Preview,Close, Remove}
currentMode=open&default=open then actions={Preview,Close,Remove}
where the action listed first is the topmost.

Comments

jonathanjfshaw created an issue. See original summary.

jonathanshaw’s picture

Issue summary: View changes
screon’s picture

I'm very interested in this one. Editing long pages is really a pain right now, since you can't collapse open paragraphs.

geek-merlin’s picture

Yes this would really help.

miro_dietiker’s picture

IMHO we will add a JS based collapse / expand feature that will always be present and affect all paragraphs without any AJAX.
Also during drag&drop it will be triggered.

I guess i'll create a separate issue about it.
We will also need to figure out how it affects the other UI settings as it seems. :-)

miro_dietiker’s picture

recrit’s picture

recrit’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 7: paragraphs-collapse-new-items-orig-2725141-2--2650306-7.patch, failed testing.

miro_dietiker’s picture

We will have a second widget and this change should only affect it. We want to avoid UX on the current existing widget.

johnchque’s picture

Component: User interface » Experimental Widget

then it goes to the Experimental widget.

miro_dietiker’s picture

Priority: Normal » Major

Let's do this ASAP. It changes visibility of buttons and changes the impact of configuration.

johnchque’s picture

Assigned: Unassigned » johnchque

Doing this. :)

johnchque’s picture

Status: Needs work » Needs review
StatusFileSize
new2.88 KB

Not sure if this breaks something. Let's try. Edit and collapse are always displayed.

recrit’s picture

#14 did not work for me with the latest. It still only showed delete (X button).
The attached checks the $paragraphs_entity which is initialized if new or existing.

wiktorb’s picture

#15 works fine - tested with both classic and experimental widget

johnchque’s picture

Assigned: johnchque » Unassigned

It needs more review. Probably check if there is some other code that can be removed.

miro_dietiker’s picture

Status: Needs review » Needs work

Tried this.

Now Collapse is always present.
After collapsing, without any change, it shows "You have unsaved changes on this Paragraph item."
This clutters the UI and questions why "Collapse" is really helping a user.
Not sure if we can solve this. We don't have change detection now. This would / will need another issue.

Also the "Duplicate" action is not visible when expanded.
#2829316: Implement "duplicate paragraphs" feature
I think this issue should always show Duplicate too.

This reminds me to the needed reference case issues that we also need to profile UI performance:
#2847110: Profile UI performance

toncic’s picture

Assigned: Unassigned » toncic
Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new3.16 KB
new48.45 KB

Re rolled patch, tested manually and changed test a little bit.
For me is working fine, providing screenshot.
The second part for displaying duplicate is done in previous issue #2851049: Enable "duplicate paragraphs" feature for paragraphs "open" mode

  • miro_dietiker committed cbe516a on 8.x-1.x authored by toncic
    Issue #2650306 by recrit, toncic, yongt9412, miro_dietiker, jonathanshaw...
miro_dietiker’s picture

Status: Needs review » Fixed

Committed with some improved asserts.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

donquixote’s picture

I understand the general motivation, but I disagree with the decision to make this universal.

There are valid use cases where specific paragraphs fields should remain always open.
Mostly if the paragraphs field allows only one or very few specific paragraphs types.

Example use case

Node type "Landing page".
- Paragraphs field, Edit mode = "Collapsed". Allowed paragraph types = All or most.

Paragraph type "Columns".
- Paragraphs field, Edit mode = "Open". Allowed paragraph types = "Column".

Paragraph type "Column":
- Paragraphs field, Edit mode = "Collapsed". Allowed paragraph types = All or most.

Having the "Collapse" button in "Columns" adds more confusion than it helps, because now we have 3 levels.

Proposed solution

I think the best option would be to have 4 options:
- Always open (NEW)
- Open, collapsible
- Closed, expansible
- Closed, show nested

Or a checkbox "Allows expand / collapse" that would be enabled by default. Unchecking this would hide all of the options.

I would do this by subclassing the widget, but I am already doing this for other purposes. Too many dimensions of inheritance are not good..