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

Multi-entity save UI: Add Discard Changes panel #36185

Draft
wants to merge 25 commits into
base: trunk
Choose a base branch
from

Conversation

ockham
Copy link
Contributor

@ockham ockham commented Nov 3, 2021

Description

This needs some UX feedback from designers, see #36185 (comment)

WIP, needs more work.

Add a second step to the multi-entity save UI which offers the user to discard any changes they made and didn't opt to save. This implements the second part of #31456 (comment) (and thus closes #31456), after #35933 implemented the first part.

How has this been tested?

  • Use the TT1 Blocks theme.
  • Go to the Site Editor, and select the Single Post Template to edit.
  • Make a few minor changes: Change the site title and tagline; insert a paragraph block with some text near the post content; change the address in the site footer.
  • Click 'Save'.
  • Select a few (but not all!) changes to save, and click 'Save' again.
  • You're presented with the "discard changes" panel.
  • To be continued

Screenshots

Current state per this PR:

image

Types of changes

New feature

TODO

@ockham ockham added [Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) [Feature] Full Site Editing labels Nov 3, 2021
@ockham ockham self-assigned this Nov 3, 2021
@github-actions
Copy link

github-actions bot commented Nov 3, 2021

Size Change: +802 B (0%)

Total Size: 1.1 MB

Filename Size Change
build/core-data/index.min.js 13.3 kB +107 B (+1%)
build/editor/index.min.js 38.3 kB +465 B (+1%)
build/editor/style-rtl.css 3.89 kB +115 B (+3%)
build/editor/style.css 3.88 kB +115 B (+3%)
ℹ️ View Unchanged
Filename Size
build/a11y/index.min.js 960 B
build/admin-manifest/index.min.js 1.1 kB
build/annotations/index.min.js 2.75 kB
build/api-fetch/index.min.js 2.21 kB
build/autop/index.min.js 2.12 kB
build/blob/index.min.js 459 B
build/block-directory/index.min.js 6.28 kB
build/block-directory/style-rtl.css 1.01 kB
build/block-directory/style.css 1.01 kB
build/block-editor/default-editor-styles-rtl.css 378 B
build/block-editor/default-editor-styles.css 378 B
build/block-editor/index.min.js 139 kB
build/block-editor/style-rtl.css 14.4 kB
build/block-editor/style.css 14.4 kB
build/block-library/blocks/archives/editor-rtl.css 61 B
build/block-library/blocks/archives/editor.css 60 B
build/block-library/blocks/archives/style-rtl.css 65 B
build/block-library/blocks/archives/style.css 65 B
build/block-library/blocks/audio/editor-rtl.css 58 B
build/block-library/blocks/audio/editor.css 58 B
build/block-library/blocks/audio/style-rtl.css 111 B
build/block-library/blocks/audio/style.css 111 B
build/block-library/blocks/audio/theme-rtl.css 125 B
build/block-library/blocks/audio/theme.css 125 B
build/block-library/blocks/block/editor-rtl.css 161 B
build/block-library/blocks/block/editor.css 161 B
build/block-library/blocks/button/editor-rtl.css 470 B
build/block-library/blocks/button/editor.css 470 B
build/block-library/blocks/button/style-rtl.css 560 B
build/block-library/blocks/button/style.css 560 B
build/block-library/blocks/buttons/editor-rtl.css 291 B
build/block-library/blocks/buttons/editor.css 291 B
build/block-library/blocks/buttons/style-rtl.css 275 B
build/block-library/blocks/buttons/style.css 275 B
build/block-library/blocks/calendar/style-rtl.css 207 B
build/block-library/blocks/calendar/style.css 207 B
build/block-library/blocks/categories/editor-rtl.css 84 B
build/block-library/blocks/categories/editor.css 83 B
build/block-library/blocks/categories/style-rtl.css 79 B
build/block-library/blocks/categories/style.css 79 B
build/block-library/blocks/code/style-rtl.css 90 B
build/block-library/blocks/code/style.css 90 B
build/block-library/blocks/code/theme-rtl.css 134 B
build/block-library/blocks/code/theme.css 134 B
build/block-library/blocks/columns/editor-rtl.css 206 B
build/block-library/blocks/columns/editor.css 205 B
build/block-library/blocks/columns/style-rtl.css 503 B
build/block-library/blocks/columns/style.css 502 B
build/block-library/blocks/cover/editor-rtl.css 546 B
build/block-library/blocks/cover/editor.css 547 B
build/block-library/blocks/cover/style-rtl.css 1.19 kB
build/block-library/blocks/cover/style.css 1.19 kB
build/block-library/blocks/embed/editor-rtl.css 488 B
build/block-library/blocks/embed/editor.css 488 B
build/block-library/blocks/embed/style-rtl.css 417 B
build/block-library/blocks/embed/style.css 417 B
build/block-library/blocks/embed/theme-rtl.css 124 B
build/block-library/blocks/embed/theme.css 124 B
build/block-library/blocks/file/editor-rtl.css 300 B
build/block-library/blocks/file/editor.css 300 B
build/block-library/blocks/file/style-rtl.css 255 B
build/block-library/blocks/file/style.css 255 B
build/block-library/blocks/file/view.min.js 322 B
build/block-library/blocks/freeform/editor-rtl.css 2.44 kB
build/block-library/blocks/freeform/editor.css 2.44 kB
build/block-library/blocks/gallery/editor-rtl.css 977 B
build/block-library/blocks/gallery/editor.css 982 B
build/block-library/blocks/gallery/style-rtl.css 1.62 kB
build/block-library/blocks/gallery/style.css 1.62 kB
build/block-library/blocks/gallery/theme-rtl.css 122 B
build/block-library/blocks/gallery/theme.css 122 B
build/block-library/blocks/group/editor-rtl.css 159 B
build/block-library/blocks/group/editor.css 159 B
build/block-library/blocks/group/style-rtl.css 57 B
build/block-library/blocks/group/style.css 57 B
build/block-library/blocks/group/theme-rtl.css 78 B
build/block-library/blocks/group/theme.css 78 B
build/block-library/blocks/heading/style-rtl.css 114 B
build/block-library/blocks/heading/style.css 114 B
build/block-library/blocks/home-link/style-rtl.css 247 B
build/block-library/blocks/home-link/style.css 247 B
build/block-library/blocks/html/editor-rtl.css 332 B
build/block-library/blocks/html/editor.css 333 B
build/block-library/blocks/image/editor-rtl.css 731 B
build/block-library/blocks/image/editor.css 730 B
build/block-library/blocks/image/style-rtl.css 507 B
build/block-library/blocks/image/style.css 511 B
build/block-library/blocks/image/theme-rtl.css 124 B
build/block-library/blocks/image/theme.css 124 B
build/block-library/blocks/latest-comments/style-rtl.css 284 B
build/block-library/blocks/latest-comments/style.css 284 B
build/block-library/blocks/latest-posts/editor-rtl.css 137 B
build/block-library/blocks/latest-posts/editor.css 137 B
build/block-library/blocks/latest-posts/style-rtl.css 528 B
build/block-library/blocks/latest-posts/style.css 527 B
build/block-library/blocks/list/style-rtl.css 94 B
build/block-library/blocks/list/style.css 94 B
build/block-library/blocks/media-text/editor-rtl.css 266 B
build/block-library/blocks/media-text/editor.css 263 B
build/block-library/blocks/media-text/style-rtl.css 493 B
build/block-library/blocks/media-text/style.css 490 B
build/block-library/blocks/more/editor-rtl.css 431 B
build/block-library/blocks/more/editor.css 431 B
build/block-library/blocks/navigation-link/editor-rtl.css 649 B
build/block-library/blocks/navigation-link/editor.css 650 B
build/block-library/blocks/navigation-link/style-rtl.css 94 B
build/block-library/blocks/navigation-link/style.css 94 B
build/block-library/blocks/navigation-submenu/editor-rtl.css 299 B
build/block-library/blocks/navigation-submenu/editor.css 299 B
build/block-library/blocks/navigation-submenu/style-rtl.css 213 B
build/block-library/blocks/navigation-submenu/style.css 213 B
build/block-library/blocks/navigation-submenu/view.min.js 343 B
build/block-library/blocks/navigation/editor-rtl.css 1.89 kB
build/block-library/blocks/navigation/editor.css 1.89 kB
build/block-library/blocks/navigation/style-rtl.css 1.56 kB
build/block-library/blocks/navigation/style.css 1.55 kB
build/block-library/blocks/navigation/view.min.js 2.74 kB
build/block-library/blocks/nextpage/editor-rtl.css 395 B
build/block-library/blocks/nextpage/editor.css 395 B
build/block-library/blocks/page-list/editor-rtl.css 377 B
build/block-library/blocks/page-list/editor.css 377 B
build/block-library/blocks/page-list/style-rtl.css 172 B
build/block-library/blocks/page-list/style.css 172 B
build/block-library/blocks/paragraph/editor-rtl.css 157 B
build/block-library/blocks/paragraph/editor.css 157 B
build/block-library/blocks/paragraph/style-rtl.css 273 B
build/block-library/blocks/paragraph/style.css 273 B
build/block-library/blocks/post-author/style-rtl.css 175 B
build/block-library/blocks/post-author/style.css 176 B
build/block-library/blocks/post-comments-form/style-rtl.css 444 B
build/block-library/blocks/post-comments-form/style.css 444 B
build/block-library/blocks/post-comments/style-rtl.css 492 B
build/block-library/blocks/post-comments/style.css 493 B
build/block-library/blocks/post-excerpt/editor-rtl.css 73 B
build/block-library/blocks/post-excerpt/editor.css 73 B
build/block-library/blocks/post-excerpt/style-rtl.css 69 B
build/block-library/blocks/post-excerpt/style.css 69 B
build/block-library/blocks/post-featured-image/editor-rtl.css 771 B
build/block-library/blocks/post-featured-image/editor.css 771 B
build/block-library/blocks/post-featured-image/style-rtl.css 153 B
build/block-library/blocks/post-featured-image/style.css 153 B
build/block-library/blocks/post-template/editor-rtl.css 99 B
build/block-library/blocks/post-template/editor.css 98 B
build/block-library/blocks/post-template/style-rtl.css 391 B
build/block-library/blocks/post-template/style.css 392 B
build/block-library/blocks/post-terms/style-rtl.css 73 B
build/block-library/blocks/post-terms/style.css 73 B
build/block-library/blocks/post-title/style-rtl.css 80 B
build/block-library/blocks/post-title/style.css 80 B
build/block-library/blocks/preformatted/style-rtl.css 103 B
build/block-library/blocks/preformatted/style.css 103 B
build/block-library/blocks/pullquote/editor-rtl.css 198 B
build/block-library/blocks/pullquote/editor.css 198 B
build/block-library/blocks/pullquote/style-rtl.css 378 B
build/block-library/blocks/pullquote/style.css 378 B
build/block-library/blocks/pullquote/theme-rtl.css 167 B
build/block-library/blocks/pullquote/theme.css 167 B
build/block-library/blocks/query-pagination-numbers/editor-rtl.css 122 B
build/block-library/blocks/query-pagination-numbers/editor.css 121 B
build/block-library/blocks/query-pagination/editor-rtl.css 262 B
build/block-library/blocks/query-pagination/editor.css 255 B
build/block-library/blocks/query-pagination/style-rtl.css 234 B
build/block-library/blocks/query-pagination/style.css 231 B
build/block-library/blocks/query/editor-rtl.css 131 B
build/block-library/blocks/query/editor.css 132 B
build/block-library/blocks/quote/style-rtl.css 187 B
build/block-library/blocks/quote/style.css 187 B
build/block-library/blocks/quote/theme-rtl.css 223 B
build/block-library/blocks/quote/theme.css 226 B
build/block-library/blocks/rss/editor-rtl.css 202 B
build/block-library/blocks/rss/editor.css 204 B
build/block-library/blocks/rss/style-rtl.css 289 B
build/block-library/blocks/rss/style.css 288 B
build/block-library/blocks/search/editor-rtl.css 165 B
build/block-library/blocks/search/editor.css 165 B
build/block-library/blocks/search/style-rtl.css 397 B
build/block-library/blocks/search/style.css 398 B
build/block-library/blocks/search/theme-rtl.css 64 B
build/block-library/blocks/search/theme.css 64 B
build/block-library/blocks/separator/editor-rtl.css 99 B
build/block-library/blocks/separator/editor.css 99 B
build/block-library/blocks/separator/style-rtl.css 245 B
build/block-library/blocks/separator/style.css 245 B
build/block-library/blocks/separator/theme-rtl.css 172 B
build/block-library/blocks/separator/theme.css 172 B
build/block-library/blocks/shortcode/editor-rtl.css 474 B
build/block-library/blocks/shortcode/editor.css 474 B
build/block-library/blocks/site-logo/editor-rtl.css 770 B
build/block-library/blocks/site-logo/editor.css 770 B
build/block-library/blocks/site-logo/style-rtl.css 165 B
build/block-library/blocks/site-logo/style.css 165 B
build/block-library/blocks/site-tagline/editor-rtl.css 86 B
build/block-library/blocks/site-tagline/editor.css 86 B
build/block-library/blocks/site-title/editor-rtl.css 84 B
build/block-library/blocks/site-title/editor.css 84 B
build/block-library/blocks/social-link/editor-rtl.css 177 B
build/block-library/blocks/social-link/editor.css 177 B
build/block-library/blocks/social-links/editor-rtl.css 824 B
build/block-library/blocks/social-links/editor.css 823 B
build/block-library/blocks/social-links/style-rtl.css 1.32 kB
build/block-library/blocks/social-links/style.css 1.32 kB
build/block-library/blocks/spacer/editor-rtl.css 307 B
build/block-library/blocks/spacer/editor.css 307 B
build/block-library/blocks/spacer/style-rtl.css 48 B
build/block-library/blocks/spacer/style.css 48 B
build/block-library/blocks/table/editor-rtl.css 471 B
build/block-library/blocks/table/editor.css 472 B
build/block-library/blocks/table/style-rtl.css 481 B
build/block-library/blocks/table/style.css 481 B
build/block-library/blocks/table/theme-rtl.css 188 B
build/block-library/blocks/table/theme.css 188 B
build/block-library/blocks/tag-cloud/style-rtl.css 146 B
build/block-library/blocks/tag-cloud/style.css 146 B
build/block-library/blocks/template-part/editor-rtl.css 560 B
build/block-library/blocks/template-part/editor.css 559 B
build/block-library/blocks/template-part/theme-rtl.css 101 B
build/block-library/blocks/template-part/theme.css 101 B
build/block-library/blocks/text-columns/editor-rtl.css 95 B
build/block-library/blocks/text-columns/editor.css 95 B
build/block-library/blocks/text-columns/style-rtl.css 166 B
build/block-library/blocks/text-columns/style.css 166 B
build/block-library/blocks/verse/style-rtl.css 87 B
build/block-library/blocks/verse/style.css 87 B
build/block-library/blocks/video/editor-rtl.css 569 B
build/block-library/blocks/video/editor.css 570 B
build/block-library/blocks/video/style-rtl.css 173 B
build/block-library/blocks/video/style.css 173 B
build/block-library/blocks/video/theme-rtl.css 124 B
build/block-library/blocks/video/theme.css 124 B
build/block-library/common-rtl.css 815 B
build/block-library/common.css 812 B
build/block-library/editor-rtl.css 9.97 kB
build/block-library/editor.css 9.97 kB
build/block-library/index.min.js 162 kB
build/block-library/reset-rtl.css 474 B
build/block-library/reset.css 474 B
build/block-library/style-rtl.css 10.5 kB
build/block-library/style.css 10.5 kB
build/block-library/theme-rtl.css 672 B
build/block-library/theme.css 677 B
build/block-serialization-default-parser/index.min.js 1.09 kB
build/block-serialization-spec-parser/index.min.js 2.79 kB
build/blocks/index.min.js 46.3 kB
build/components/index.min.js 214 kB
build/components/style-rtl.css 15.3 kB
build/components/style.css 15.3 kB
build/compose/index.min.js 10.9 kB
build/customize-widgets/index.min.js 11.4 kB
build/customize-widgets/style-rtl.css 1.5 kB
build/customize-widgets/style.css 1.49 kB
build/data-controls/index.min.js 631 B
build/data/index.min.js 7.42 kB
build/date/index.min.js 31.5 kB
build/deprecated/index.min.js 485 B
build/dom-ready/index.min.js 304 B
build/dom/index.min.js 4.5 kB
build/edit-navigation/index.min.js 16 kB
build/edit-navigation/style-rtl.css 3.76 kB
build/edit-navigation/style.css 3.76 kB
build/edit-post/classic-rtl.css 492 B
build/edit-post/classic.css 494 B
build/edit-post/index.min.js 29.6 kB
build/edit-post/style-rtl.css 7.1 kB
build/edit-post/style.css 7.09 kB
build/edit-site/index.min.js 33.2 kB
build/edit-site/style-rtl.css 6.1 kB
build/edit-site/style.css 6.1 kB
build/edit-widgets/index.min.js 16.5 kB
build/edit-widgets/style-rtl.css 4.18 kB
build/edit-widgets/style.css 4.18 kB
build/element/index.min.js 3.29 kB
build/escape-html/index.min.js 517 B
build/format-library/index.min.js 6.57 kB
build/format-library/style-rtl.css 571 B
build/format-library/style.css 571 B
build/hooks/index.min.js 1.63 kB
build/html-entities/index.min.js 424 B
build/i18n/index.min.js 3.71 kB
build/is-shallow-equal/index.min.js 501 B
build/keyboard-shortcuts/index.min.js 1.8 kB
build/keycodes/index.min.js 1.39 kB
build/list-reusable-blocks/index.min.js 1.86 kB
build/list-reusable-blocks/style-rtl.css 838 B
build/list-reusable-blocks/style.css 838 B
build/media-utils/index.min.js 2.92 kB
build/notices/index.min.js 925 B
build/nux/index.min.js 2.08 kB
build/nux/style-rtl.css 747 B
build/nux/style.css 743 B
build/plugins/index.min.js 1.84 kB
build/primitives/index.min.js 924 B
build/priority-queue/index.min.js 582 B
build/react-i18n/index.min.js 671 B
build/redux-routine/index.min.js 2.65 kB
build/reusable-blocks/index.min.js 2.22 kB
build/reusable-blocks/style-rtl.css 256 B
build/reusable-blocks/style.css 256 B
build/rich-text/index.min.js 11 kB
build/server-side-render/index.min.js 1.57 kB
build/shortcode/index.min.js 1.49 kB
build/token-list/index.min.js 639 B
build/url/index.min.js 1.9 kB
build/viewport/index.min.js 1.05 kB
build/warning/index.min.js 248 B
build/widgets/index.min.js 7.15 kB
build/widgets/style-rtl.css 1.16 kB
build/widgets/style.css 1.16 kB
build/wordcount/index.min.js 1.04 kB

compressed-size-action

@paaljoachim
Copy link
Contributor

paaljoachim commented Nov 4, 2021

Looks good Bernie! Thank you!

The process is like so:
User clicks the Save button sees options of various areas to save. Decides to uncheck two areas.

Screenshot 2021-11-04 at 11 58 16

Clicks Save again.
Clicks Front Page and Another post to discard the changes.

Screenshot 2021-11-04 at 11 59 21

(I am also seeing a "Continue editing" button further down.)

Clicks the "Discard changes" button. Panel is closed and user is returned to working on the layout.
The Save button is still active and not greyed out.

The question comes up.... what does discard actually do?
I assume that discard is the same as revert the current selected area back to what it was the last time it was saved.

@javierarce @critterverse

@ockham
Copy link
Contributor Author

ockham commented Nov 4, 2021

Clicks the "Discard changes" button. Panel is closed and user is returned to working on the layout.
The Save button is still active and not greyed out.

The question comes up.... what does discard actually do?
I assume that discard is the same as revert the current selected area back to what it was the last time it was saved.

Yeah, that's what I also think it means. I just haven't implemented that behavior yet 😅 (that's the "Correctly wire buttons, checkboxes, etc" item in my little todo list in the PR desc 😉)

@ockham
Copy link
Contributor Author

ockham commented Nov 4, 2021

Took me a while to figure out how to implement discarding changes; turns out we didn't have any actions to reset an entity record's edits (that's what discarding changes translates to in Gutenberg parlance), so I had to implement something.

This still needs a bit of polish plus some test coverage etc, which I could probably finish tomorrow 🤞


The most important question however is what to do with the undo stack: Typically, every change (edit) creates an entry on the undo stack, which allows the user to go back in time step by step.

AFAICT, the feature we're introducing here -- discarding changes on a per-entity basis -- doesn't seem to be entirely compatible with that pattern:

  • It doesn't just affect one change, but all changes to a given thing ("entity record") since it was last saved.
  • Those changes might not have happened subsequently, but interspersed with changes to other entity records.

Here's an example: After freshly opening some template in the site editor, the user does the following the site editor, in order:

  • Changes some text in the header.
  • Changes the site title.
  • Adds an image block to the header.
  • Changes the site tagline.
  • Changes some text in the footer.
  • Adds some more text to the header.
  • Changes the site title once again.

Using undo, we could obviously go back step by step.

Now let's say the user clicks Save, but decides to only save the text change to the footer template part. This means that our new discard panel then asks them if they want to discard the other changes that they made to the header, site title, and tagline. Let's say the user chooses to discard the changes to the header and the site tagline: Those changes are then rolled back, whereas the ones to the site title are kept.

Now what should happen to the undo stack (and button)? What would be most intuitive for the user? I can think of some options.

  1. Discarding the changes is recorded on the undo stack itself, so if the user clicks undo, the changes that they just dismissed are brought back.
    • This probably works if the user only discarded changes to one thing, but it might not be possible if they discarded changes to multiple things (like in our example). (After all, it's also not possible in manual editing to, say, modify the header and site tagline at once -- and that fact is somewhat reflected by the undo stack implementation.)
  2. Disable the undo button (i.e. clear the undo stack). Might be conceptually clean, but seems like a bit of a sledgehammer approach to me.
  3. Remove the discarded changes from the undo stack, and keep the other ones. In our example, this would mean that after discarding the changes to header and site tagline, the undo stack would shrink to
  • Changes the site title.
  • Changes some text in the footer.
  • Changes the site title once again.

Would that feel intuitive to the user, if they started clicking the undo button? Are there any more intuitive options that I'm missing?

@javierarce @critterverse

@ockham ockham added Needs Design Feedback Needs general design feedback. [Status] Blocked Used to indicate that a current effort isn't able to move forward labels Nov 4, 2021
@ockham
Copy link
Contributor Author

ockham commented Nov 4, 2021

Forgot to say, there's also the concept of transient edits (which don't create entries on the undo stack, nor do they dirty an entity's state), but I believe that they're "merged" into the next item on the undo stack, and I don't think we want that(?) (Though I have to say my understanding of transient edits might be a bit fuzzy.)

@ockham ockham force-pushed the add/multi-entity-saving-discard-entities-panel branch from 7662051 to 4ef3551 Compare November 5, 2021 11:32
@talldan
Copy link
Contributor

talldan commented Nov 5, 2021

@ockham I face a similar conundrum over on #36030 (also some related discussion on #36027).

For removing an entity, I was going for the third option you outline.

For a discard though, it does seem like something a user might be able to undo.

@ockham ockham force-pushed the add/multi-entity-saving-discard-entities-panel branch from 07e8a7b to 184d61e Compare November 5, 2021 21:00
@ockham
Copy link
Contributor Author

ockham commented Nov 5, 2021

@ockham I face a similar conundrum over on #36030 (also some related discussion on #36027).

For removing an entity, I was going for the third option you outline.

For a discard though, it does seem like something a user might be able to undo.

Thanks a lot @talldan, I was unaware of #36030 -- it's indeed a similar problem.

I've been giving this some more thought. We might not necessarily need to allow the user to undo the discard -- it's after all highlighted as a destructive option.

For now, I've decided to try to implement the discard through EDIT_ENTITY_RECORD (with meta: { undo: undefined }). I'll see how far this can get us...

@ockham ockham force-pushed the add/multi-entity-saving-discard-entities-panel branch from 52b8766 to f652bef Compare November 10, 2021 14:00
@javierarce javierarce self-requested a review November 10, 2021 16:44
@ockham
Copy link
Contributor Author

ockham commented Nov 10, 2021

I think this is coming together. I need a bit of design input for one transition, though: After clicking 'Save', GB takes a moment to actually save the changed entities. Currently, it already moves on to the 'Discard' screen, and for a brief moment, all entity change checkboxes are carried over (even the ones that were just saved):

multi-entity save discard

As a minimum, we should probably disable the interactive elements (checkboxes, "Discard changes", and "Continue Editing" buttons) in the sidebar while saving.

I'd appreciate some guidance/mockups from a designer! 🙏

@paaljoachim
Copy link
Contributor

Testing the PR with a "ops I made a change to a Reusable block" situation. As this part of the feature will be extremely helpful for all those folks making accidental changes to a Reusable block.

This is what I see:

Discard-save-reusable-block.mp4

Walking through the scenario.
1- Make a change to a Reusable block.
2- Notice the dot show up beside the active Update... button.
3- Click Update.
4- Save panel is seen.
5- Unclick the checkbox to not save the Reusable block change.
6- Click Save.
7- Notice that for a moment both checkboxes are carried over (also seen in Bernies video above).
I would suggest to have a spinner animation https://wordpress.github.io/gutenberg/?path=/story/components-spinner--default to show that something is happening instead of showing all the checkboxes. Using it for a moment before moving on to only show the discarded checkboxes.

8- Click the checkbox and then the Discard changes button to discard the option.
9- Exits the Update/Save panel procedure.

@ockham ockham force-pushed the add/multi-entity-saving-discard-entities-panel branch from e007e8d to dc377d0 Compare November 12, 2021 13:42
@javierarce
Copy link
Contributor

The question comes up.... what does discard actually do?
I assume that discard is the same as revert the current selected area back to what it was the last time it was saved.

Sorry for my late reply, @paaljoachim & @ockham… yes, that's exactly what the button does.

Regarding the rest of the PR, it looks good! I only miss the success message indicating that the previous save action was successful. Otherwise, the "What's next" title will be confusing. That title is also important because we aren't showing the snack bar.

I also think that we could remove the "Continue editing" button. It's too far away from the other actions (the discard button and the close button at the top) and competes with them.

If you all agree to make this change, we should then update the message to something like:

What's next?
Your template still has some unsaved changes.
You can select them and discard their changes now, or close the panel and deal with them later.

@javierarce
Copy link
Contributor

javierarce commented Nov 12, 2021

I think this is coming together. I need a bit of design input for one transition, though: After clicking 'Save', GB takes a moment to actually save the changed entities. Currently, it already moves on to the 'Discard' screen, and for a brief moment, all entity change checkboxes are carried over (even the ones that were just saved)

As @paaljoachim suggests, could we do the opposite? Hide every item and just show the ones that make sense to show?

@javierarce
Copy link
Contributor

Something important we should also include is a snackbar message after the user discards the changes.

Some suggestions for the message (depending on the number of items reverted):

  • "All changes were discarded"
  • "Some changes were discarded"

Another idea. In case there's just one change reverted, we could try this:

  • "Changes to Tagline were discarded."

@paaljoachim
Copy link
Contributor

That is a good idea Javier!
Actually having the snackbar list the discarded changes would be very helpful!

@paaljoachim
Copy link
Contributor

paaljoachim commented Nov 12, 2021

What if the user makes one change and decides not to save it?

Like so:
Screenshot 2021-11-12 at 21 20 31

Should the button with the word "Save" change to a button with the word "Discard"?
As right now the only way to exit the Save panel is to click the X to the right of the Save button.

As there is no way to move onward to the Discard section.

@ockham
Copy link
Contributor Author

ockham commented Nov 12, 2021

I only miss the success message indicating that the previous save action was successful. Otherwise, the "What's next" title will be confusing. That title is also important because we aren't showing the snack bar.

Ah right, I meant to add that later but forgot. I'll add it!

I also think that we could remove the "Continue editing" button. It's too far away from the other actions (the discard button and the close button at the top) and competes with them.

Agree 👍

If you all agree to make this change, we should then update the message to something like:

What's next?
Your template still has some unsaved changes.
You can select them and discard their changes now, or close the panel and deal with them later.

Will do!

@ockham
Copy link
Contributor Author

ockham commented Nov 12, 2021

I've changed the logic for the discard panel to filter the changes that are currently being saved from the list. (It needs some tweaking, since it always removes site entities, such as title and tagline.)

Furthermore, I've removed the "Continue editing" button, adapted the wording accordingly, and added the "Templated updated!" message. I now remember why I procrastinated on the latter: its bottom padding is too small, and it seems to require quite a bit of effort to get it right 🙄

image

Still hatin' CSS 😬

I'll continue on Monday.

@ockham
Copy link
Contributor Author

ockham commented Nov 16, 2021

What if the user makes one change and decides not to save it?

Like so: Screenshot 2021-11-12 at 21 20 31

Should the button with the word "Save" change to a button with the word "Discard"?

My 2 cents: I don't think that the same button (i.e. same style, same position) should contextually change its function, especially if it's the exact opposite of what it normally does. Users will develop some sort of "muscle memory" and will get used to that button doing one (non-destructive) thing (saving) in most cases; we shouldn't change that to a destructive one in exceptional cases (discarding).

(There might even be some more abstract/general design pattern for this kind of thing, but I'll have to defer to designers on that 😅 )

As right now the only way to exit the Save panel is to click the X to the right of the Save button.

I think that's sufficient -- it's kind of a "cancel operation" function in all cases.

As there is no way to move onward to the Discard section.

Right, so the major difference is that we'd be lacking an option that allows us to roll back that one change to the state when it was last saved. I think that's okay, since it's only one change, so the user probably remembers what it was like before, and can revert it manually. (Alternatively, reloading the page should have the same effect.)

Happy to discuss/implement alternatives!

@ockham ockham force-pushed the add/multi-entity-saving-discard-entities-panel branch from 30e4e33 to b9deaea Compare November 17, 2021 20:04
@paaljoachim
Copy link
Contributor

paaljoachim commented Nov 19, 2021

The Site Editor Discard flow works well!
(When having atleast one item that is to be saved.)

Site-Editor-Discard-Save.mp4



Moving on to....

Making one change.

Site Editor

Step 1.
This is what it looks like in the Site Editor:
Screenshot 2021-11-19 at 01 07 44

Step 2.
Clicking Save and unchecking Title.
Screenshot 2021-11-19 at 01 10 25

We get trapped. No way to discard the change to the Title.

Post Editor

Step 1.
This is what it looks like in the Post Editor:
Screenshot 2021-11-19 at 01 09 32

Step 2.
Clicking Update and unchecking the Reusable block.
Screenshot 2021-11-19 at 01 13 15

We get trapped. No way to discard the change to the Reusable block.


(First of I would suggest to remove the dot seen in the Update button (Post Editor). It would be nice to keep the Post Editor flow as similar to the Site Editor save flow as possible.)

We need a discard flow for when no item is to be saved. How would we move on to the discard panel when no item has been checked and the Save button is greyed out?

Here is one suggestion. Unchecking so no item it so be saved the Discard button could show up below.
It can be a bit confusing. As do one need to check both items and then click the Discard button, or can one just click the discard button to discard and revert both items?

No-save-Discard-Changes

@javierarce Javier what would you suggest?

@paaljoachim
Copy link
Contributor

I see this PR has stopped up. It would be great to get some movement again here!
Thanks!

@javierarce
Copy link
Contributor

👋 Chiming in just to say that I'll try to review this PR this week.

@ockham
Copy link
Contributor Author

ockham commented Dec 14, 2021

I see this PR has stopped up. It would be great to get some movement again here!
Thanks!

Yeah, sorry about that 😕 As stated on the related issue, the multi-entity saving code is pretty complex, and I had to prioritize some other WP 5.9 stuff.

As for this PR, it's even worse: There's the bug (#36096), there's the UX questions (such as this), and then, there's different contexts (the premises for multi-entity saving in the site editor are quite different from the post editor). We might actually need more UX input, especially for the post editor context.

👋 Chiming in just to say that I'll try to review this PR this week.

@javierarce Thanks a lot for offering -- I'm just not quite sure this is ready for prime-time yet. Maybe do try it out both in the site and post editors, and have a look at @paaljoachim's comments above; we might need some more UX guidance 😅

@paaljoachim
Copy link
Contributor

Hey Bernie @ockham

I am checking in. Can we get a status update as to the next steps needed?
Thanks!

@annezazu annezazu added [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") and removed [Feature] Full Site Editing labels Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) Needs Design Feedback Needs general design feedback. [Status] Blocked Used to indicate that a current effort isn't able to move forward
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improving multi-entity saving UI method.
5 participants