Problem/Motivation

Removing the layout from an entity bundle is a destructive action, and should be behind a confirmation form.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

tim.plunkett created an issue. See original summary.

tim.plunkett’s picture

larowlan’s picture

Status: Postponed » Active
xjm’s picture

Priority: Normal » Major

This might be critical if LB were stable, so promoting to major.

tim.plunkett’s picture

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

xjm’s picture

Category: Task » Bug report
Issue tags: -Layout Builder stable blocker +Layout Builder beta blocker
StatusFileSize
new179.89 KB

This is a bug, and would indeed be critical. We have precedent for that for the views/config issue... except this is even worse because that at least had a confirmation form that was hard to read (whereas this one makes a stray mouse click destroy tons of work.)

As a data loss issue, we would make it critical even while LB is in beta. It can remain major while LB is in alpha.

Edit: I mistakenly thought this was the issue for a different problem, wherein the "Revert to defaults" link deletes your layout override with no warning/confirmation/clicking save. Per @tim.plunkett it's a separate issue though, so moving that back to the other issue (there's already a fix for it there now).

I'll test this one and confirm whether it also needs some removal/fix/prevention before beta.

tim.plunkett’s picture

Status: Active » Needs review
StatusFileSize
new9.4 KB
new114.25 KB

This is blocked on #2922033: Use the Layout Builder for EntityViewDisplays
Interdiff against that issue.

Status: Needs review » Needs work

The last submitted patch, 8: 2914484-field_ui-8.patch, failed testing. View results

tim.plunkett’s picture

Status: Needs work » Needs review
StatusFileSize
new5.16 KB
new116.54 KB
new12.75 KB
tim.plunkett’s picture

StatusFileSize
new12.75 KB
tim.plunkett’s picture

xjm’s picture

StatusFileSize
new106.76 KB
  1. Probably we should make the help text not display on that route? For most things it's probably not a big deal for beta, but in the case of this form it kinda distracts from what the form says for an operation that removes data.
     
  2. I think we should also tell the user what the consequences of the action are. At the least, something like "Any customized layouts will be permanently deleted." But ideally we'd say something like "13 customized layouts will be deleted."
     
  3. Along those lines, unchecking the box is harmless if there are 0 customized layouts. I couldn't think of any examples in core of something that would delete 0 things to use as precedent one way or the other.
     
  4. It alarmingly says "Your settings have been saved" before the user confirms. (I verified that the settings have not, in fact, been saved -- the overrides are still enabled -- so it's just that the status message is being displayed prematurely.)
tim.plunkett’s picture

StatusFileSize
new2.75 KB
new12.75 KB

#13
1) Fixed

2) I went with the improved message but without a count

3) The button isn't necessarily as harmless as that. I started looking into the code for such a query, until I remembered that we'd also be kicking people out mid-tempstore. If we went "oh there are 0 overrides on disk, let's skip the form" but someone was mid-flow, they'd be just as screwed as if they'd saved it.
So, keeping the existing logic and warning always.

4) This is tricky. At least in the case of the "Default" view mode, there are other form elements on the page that are indeed saved!
For example, the other fieldset "CUSTOM DISPLAY SETTINGS".
*Those* values are indeed saved...
Not sure what to do about that.

From what I can see, we have 3 options:
Leave the message as is
Move this checkbox somewhere else (where?)
Somehow magically defer the saving of the rest of the form until after this other confirm (is that possible? what if they hit cancel, do we discard their other changes?)

tim.plunkett’s picture

I think that #13.4 could lead to some iterations with the UX team, and I think that could be done after beta, so I opened #2941189: Confirmation form for disabling per-entity layout overrides shows a success message and should not.

xjm’s picture

Issue tags: +Needs usability review

Hmm, #4 seems problematic. I would definitely not expect that other values on the page had been saved if I went to a confirmation form and then hit cancel. I'm reluctant to defer that to a followup since it would be a major bug IMO. Tagging for usability review to see if we can get some suggestions.

For #3, how about we tell the user explicitly about currently edited things? E.g.:

13 customized layouts will be permanently deleted, and any unsaved custom layouts will be lost.

Or if there are none, just:

Any unsaved custom layouts will be lost.

tim.plunkett’s picture

There is currently no mechanism for determining the overrides that correspond to a given default.
The entire system is written the other direction (an override can retrieve it's corresponding default)

tim.plunkett’s picture

If we want to add such a mechanism, that would block this issue on #2937483: Defining a new type of section storage relies on magic strings and hidden assumptions (also a beta blocker).

tim.plunkett’s picture

StatusFileSize
new3.31 KB

Here's an alternate solution proposed by @xjm:
Disable the checkbox when overrides exist.
And then find a more elegant solution in the follow-up.

No interdiff as this is a completely new approach.

tim.plunkett’s picture

Title: Present a confirmation form before removing the layout field from an entity bundle. » Prevent the layout field from being removed if overrides exist
Issue tags: -Needs usability review

Tagging the follow up for UX review.

eclipsegc’s picture

Ok, so this new version of the patch sidesteps the whole confirmation issue by simply preventing the unclicking of the form element when overrides exist. As solutions go, this seems like a pretty straight-forward one and I think covers the data loss concern sufficiently. Assuming this passes tests I'm totally on board and saw nothing in the patch that concerned me. Anyone else have push-back on this approach?

Eclipse

xjm’s picture

+1 for this approach as an intermediate step.

Should we also add a test that the checkbox is again uncheckable when you revert an overridden layout to the default?

xjm’s picture

I manually tested a few different scenarios and it seems to work fine; no weird/confusing things.

tim.plunkett’s picture

Good idea! Added.

eclipsegc’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me!

Eclipse

larowlan’s picture

  • larowlan committed 9d81d2c on 8.6.x
    Issue #2914484 by tim.plunkett, larowlan, xjm: Prevent the layout field...
larowlan’s picture

Status: Reviewed & tested by the community » Fixed

Committed 9d81d2c and pushed to 8.6.x

One more down

xjm’s picture

Status: Reviewed & tested by the community » Fixed

OK this will work better if I actually post using my account. Retroactively adding credit for Kris and Sam who helped decide the approach with us in Slack. :)

eclipsegc’s picture

thanks! :-D

Status: Fixed » Closed (fixed)

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

tim.plunkett’s picture

Component: layout.module » layout_builder.module