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

Refine rename flow for blocks with overrides #60234

Merged
merged 7 commits into from
Apr 12, 2024

Conversation

kevin940726
Copy link
Member

@kevin940726 kevin940726 commented Mar 27, 2024

What?

Part of #59813. Supersedes #60066. Also close #60118.

The latest design is #60234 (comment)

This PR does a few things:

  1. If no name exists on block, and overrides is disabled, use "allow overrides" button
  2. If name exists and overrides is disabled, use toggle
  3. If overrides is enabled, use toggle
  4. When clicking button, show "allow overrides" modal that is essentially a rebranded "rename block" modal
  5. In all other rename actions, use the standard rename modal with overrides warning text
  6. The default state for overrides is disabled, users have to opt-in to enable pattern overrides

Why?

This is to simplify the UI flow for renaming and toggling overrides for blocks.

How?

Add overrides warning to the rename modal and change the overrides control to a button when there's no name.

Testing Instructions

  1. Create a synced pattern and add a few paragraphs.
  2. If the block has no name, the control should show a button for overrides.
  3. Clicking on the button should open a renaming modal.
  4. Once the block is named, the control becomes a toggle button.
  5. Other renaming flow (list view, block toolbar, shortcut) should show overrides warning.

Screenshots or screencast

Kapture.2024-04-03.at.21.34.10.mp4
@kevin940726 kevin940726 added [Type] Enhancement A suggestion for improvement. Needs Design Feedback Needs general design feedback. [Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) labels Mar 27, 2024
@kevin940726 kevin940726 self-assigned this Mar 27, 2024
Copy link

github-actions bot commented Mar 27, 2024

Size Change: +721 B (0%)

Total Size: 1.75 MB

Filename Size Change
build/block-editor/index.min.js 255 kB +110 B (0%)
build/components/index.min.js 222 kB +14 B (0%)
build/editor/index.min.js 70 kB +39 B (0%)
build/patterns/index.min.js 6.38 kB +475 B (+8%) 🔍
build/patterns/style-rtl.css 595 B +41 B (+7%) 🔍
build/patterns/style.css 595 B +42 B (+8%) 🔍
ℹ️ View Unchanged
Filename Size
build/a11y/index.min.js 955 B
build/annotations/index.min.js 2.27 kB
build/api-fetch/index.min.js 2.32 kB
build/autop/index.min.js 2.1 kB
build/blob/index.min.js 578 B
build/block-directory/index.min.js 7.26 kB
build/block-directory/style-rtl.css 1.03 kB
build/block-directory/style.css 1.03 kB
build/block-editor/content-rtl.css 4.46 kB
build/block-editor/content.css 4.46 kB
build/block-editor/default-editor-styles-rtl.css 395 B
build/block-editor/default-editor-styles.css 395 B
build/block-editor/style-rtl.css 15.6 kB
build/block-editor/style.css 15.6 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 90 B
build/block-library/blocks/archives/style.css 90 B
build/block-library/blocks/audio/editor-rtl.css 150 B
build/block-library/blocks/audio/editor.css 150 B
build/block-library/blocks/audio/style-rtl.css 122 B
build/block-library/blocks/audio/style.css 122 B
build/block-library/blocks/audio/theme-rtl.css 133 B
build/block-library/blocks/audio/theme.css 133 B
build/block-library/blocks/avatar/editor-rtl.css 116 B
build/block-library/blocks/avatar/editor.css 116 B
build/block-library/blocks/avatar/style-rtl.css 104 B
build/block-library/blocks/avatar/style.css 104 B
build/block-library/blocks/block/editor-rtl.css 305 B
build/block-library/blocks/block/editor.css 305 B
build/block-library/blocks/button/editor-rtl.css 415 B
build/block-library/blocks/button/editor.css 414 B
build/block-library/blocks/button/style-rtl.css 627 B
build/block-library/blocks/button/style.css 626 B
build/block-library/blocks/buttons/editor-rtl.css 337 B
build/block-library/blocks/buttons/editor.css 337 B
build/block-library/blocks/buttons/style-rtl.css 332 B
build/block-library/blocks/buttons/style.css 332 B
build/block-library/blocks/calendar/style-rtl.css 239 B
build/block-library/blocks/calendar/style.css 239 B
build/block-library/blocks/categories/editor-rtl.css 113 B
build/block-library/blocks/categories/editor.css 112 B
build/block-library/blocks/categories/style-rtl.css 124 B
build/block-library/blocks/categories/style.css 124 B
build/block-library/blocks/code/editor-rtl.css 53 B
build/block-library/blocks/code/editor.css 53 B
build/block-library/blocks/code/style-rtl.css 121 B
build/block-library/blocks/code/style.css 121 B
build/block-library/blocks/code/theme-rtl.css 124 B
build/block-library/blocks/code/theme.css 124 B
build/block-library/blocks/columns/editor-rtl.css 108 B
build/block-library/blocks/columns/editor.css 108 B
build/block-library/blocks/columns/style-rtl.css 421 B
build/block-library/blocks/columns/style.css 421 B
build/block-library/blocks/comment-author-avatar/editor-rtl.css 125 B
build/block-library/blocks/comment-author-avatar/editor.css 125 B
build/block-library/blocks/comment-content/style-rtl.css 92 B
build/block-library/blocks/comment-content/style.css 92 B
build/block-library/blocks/comment-template/style-rtl.css 199 B
build/block-library/blocks/comment-template/style.css 198 B
build/block-library/blocks/comments-pagination-numbers/editor-rtl.css 123 B
build/block-library/blocks/comments-pagination-numbers/editor.css 121 B
build/block-library/blocks/comments-pagination/editor-rtl.css 222 B
build/block-library/blocks/comments-pagination/editor.css 209 B
build/block-library/blocks/comments-pagination/style-rtl.css 235 B
build/block-library/blocks/comments-pagination/style.css 231 B
build/block-library/blocks/comments-title/editor-rtl.css 75 B
build/block-library/blocks/comments-title/editor.css 75 B
build/block-library/blocks/comments/editor-rtl.css 840 B
build/block-library/blocks/comments/editor.css 839 B
build/block-library/blocks/comments/style-rtl.css 637 B
build/block-library/blocks/comments/style.css 636 B
build/block-library/blocks/cover/editor-rtl.css 647 B
build/block-library/blocks/cover/editor.css 650 B
build/block-library/blocks/cover/style-rtl.css 1.7 kB
build/block-library/blocks/cover/style.css 1.69 kB
build/block-library/blocks/details/editor-rtl.css 65 B
build/block-library/blocks/details/editor.css 65 B
build/block-library/blocks/details/style-rtl.css 86 B
build/block-library/blocks/details/style.css 86 B
build/block-library/blocks/embed/editor-rtl.css 322 B
build/block-library/blocks/embed/editor.css 322 B
build/block-library/blocks/embed/style-rtl.css 410 B
build/block-library/blocks/embed/style.css 410 B
build/block-library/blocks/embed/theme-rtl.css 133 B
build/block-library/blocks/embed/theme.css 133 B
build/block-library/blocks/file/editor-rtl.css 326 B
build/block-library/blocks/file/editor.css 327 B
build/block-library/blocks/file/style-rtl.css 280 B
build/block-library/blocks/file/style.css 281 B
build/block-library/blocks/file/view.min.js 324 B
build/block-library/blocks/footnotes/style-rtl.css 201 B
build/block-library/blocks/footnotes/style.css 199 B
build/block-library/blocks/form-input/editor-rtl.css 227 B
build/block-library/blocks/form-input/editor.css 227 B
build/block-library/blocks/form-input/style-rtl.css 343 B
build/block-library/blocks/form-input/style.css 343 B
build/block-library/blocks/form-submission-notification/editor-rtl.css 340 B
build/block-library/blocks/form-submission-notification/editor.css 340 B
build/block-library/blocks/form-submit-button/style-rtl.css 69 B
build/block-library/blocks/form-submit-button/style.css 69 B
build/block-library/blocks/form/view.min.js 471 B
build/block-library/blocks/freeform/editor-rtl.css 2.61 kB
build/block-library/blocks/freeform/editor.css 2.61 kB
build/block-library/blocks/gallery/editor-rtl.css 947 B
build/block-library/blocks/gallery/editor.css 952 B
build/block-library/blocks/gallery/style-rtl.css 1.72 kB
build/block-library/blocks/gallery/style.css 1.72 kB
build/block-library/blocks/gallery/theme-rtl.css 108 B
build/block-library/blocks/gallery/theme.css 108 B
build/block-library/blocks/group/editor-rtl.css 647 B
build/block-library/blocks/group/editor.css 647 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 189 B
build/block-library/blocks/heading/style.css 189 B
build/block-library/blocks/html/editor-rtl.css 336 B
build/block-library/blocks/html/editor.css 337 B
build/block-library/blocks/image/editor-rtl.css 878 B
build/block-library/blocks/image/editor.css 878 B
build/block-library/blocks/image/style-rtl.css 1.6 kB
build/block-library/blocks/image/style.css 1.59 kB
build/block-library/blocks/image/theme-rtl.css 133 B
build/block-library/blocks/image/theme.css 133 B
build/block-library/blocks/image/view.min.js 1.54 kB
build/block-library/blocks/latest-comments/style-rtl.css 357 B
build/block-library/blocks/latest-comments/style.css 357 B
build/block-library/blocks/latest-posts/editor-rtl.css 213 B
build/block-library/blocks/latest-posts/editor.css 212 B
build/block-library/blocks/latest-posts/style-rtl.css 478 B
build/block-library/blocks/latest-posts/style.css 478 B
build/block-library/blocks/list/style-rtl.css 88 B
build/block-library/blocks/list/style.css 88 B
build/block-library/blocks/media-text/editor-rtl.css 306 B
build/block-library/blocks/media-text/editor.css 305 B
build/block-library/blocks/media-text/style-rtl.css 505 B
build/block-library/blocks/media-text/style.css 503 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 668 B
build/block-library/blocks/navigation-link/editor.css 669 B
build/block-library/blocks/navigation-link/style-rtl.css 259 B
build/block-library/blocks/navigation-link/style.css 257 B
build/block-library/blocks/navigation-submenu/editor-rtl.css 296 B
build/block-library/blocks/navigation-submenu/editor.css 295 B
build/block-library/blocks/navigation/editor-rtl.css 2.26 kB
build/block-library/blocks/navigation/editor.css 2.26 kB
build/block-library/blocks/navigation/style-rtl.css 2.26 kB
build/block-library/blocks/navigation/style.css 2.25 kB
build/block-library/blocks/navigation/view.min.js 1.03 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 175 B
build/block-library/blocks/page-list/style.css 175 B
build/block-library/blocks/paragraph/editor-rtl.css 235 B
build/block-library/blocks/paragraph/editor.css 235 B
build/block-library/blocks/paragraph/style-rtl.css 335 B
build/block-library/blocks/paragraph/style.css 335 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/editor-rtl.css 96 B
build/block-library/blocks/post-comments-form/editor.css 96 B
build/block-library/blocks/post-comments-form/style-rtl.css 508 B
build/block-library/blocks/post-comments-form/style.css 508 B
build/block-library/blocks/post-content/editor-rtl.css 74 B
build/block-library/blocks/post-content/editor.css 74 B
build/block-library/blocks/post-date/style-rtl.css 61 B
build/block-library/blocks/post-date/style.css 61 B
build/block-library/blocks/post-excerpt/editor-rtl.css 71 B
build/block-library/blocks/post-excerpt/editor.css 71 B
build/block-library/blocks/post-excerpt/style-rtl.css 141 B
build/block-library/blocks/post-excerpt/style.css 141 B
build/block-library/blocks/post-featured-image/editor-rtl.css 666 B
build/block-library/blocks/post-featured-image/editor.css 662 B
build/block-library/blocks/post-featured-image/style-rtl.css 342 B
build/block-library/blocks/post-featured-image/style.css 342 B
build/block-library/blocks/post-navigation-link/style-rtl.css 215 B
build/block-library/blocks/post-navigation-link/style.css 214 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 409 B
build/block-library/blocks/post-template/style.css 408 B
build/block-library/blocks/post-terms/style-rtl.css 96 B
build/block-library/blocks/post-terms/style.css 96 B
build/block-library/blocks/post-time-to-read/style-rtl.css 69 B
build/block-library/blocks/post-time-to-read/style.css 69 B
build/block-library/blocks/post-title/style-rtl.css 100 B
build/block-library/blocks/post-title/style.css 100 B
build/block-library/blocks/preformatted/style-rtl.css 125 B
build/block-library/blocks/preformatted/style.css 125 B
build/block-library/blocks/pullquote/editor-rtl.css 135 B
build/block-library/blocks/pullquote/editor.css 135 B
build/block-library/blocks/pullquote/style-rtl.css 354 B
build/block-library/blocks/pullquote/style.css 353 B
build/block-library/blocks/pullquote/theme-rtl.css 174 B
build/block-library/blocks/pullquote/theme.css 174 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 221 B
build/block-library/blocks/query-pagination/editor.css 211 B
build/block-library/blocks/query-pagination/style-rtl.css 288 B
build/block-library/blocks/query-pagination/style.css 284 B
build/block-library/blocks/query-title/style-rtl.css 63 B
build/block-library/blocks/query-title/style.css 63 B
build/block-library/blocks/query/editor-rtl.css 486 B
build/block-library/blocks/query/editor.css 486 B
build/block-library/blocks/query/view.min.js 958 B
build/block-library/blocks/quote/style-rtl.css 237 B
build/block-library/blocks/quote/style.css 237 B
build/block-library/blocks/quote/theme-rtl.css 233 B
build/block-library/blocks/quote/theme.css 235 B
build/block-library/blocks/read-more/style-rtl.css 140 B
build/block-library/blocks/read-more/style.css 140 B
build/block-library/blocks/rss/editor-rtl.css 149 B
build/block-library/blocks/rss/editor.css 149 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 184 B
build/block-library/blocks/search/editor.css 184 B
build/block-library/blocks/search/style-rtl.css 690 B
build/block-library/blocks/search/style.css 689 B
build/block-library/blocks/search/theme-rtl.css 114 B
build/block-library/blocks/search/theme.css 114 B
build/block-library/blocks/search/view.min.js 478 B
build/block-library/blocks/separator/editor-rtl.css 146 B
build/block-library/blocks/separator/editor.css 146 B
build/block-library/blocks/separator/style-rtl.css 229 B
build/block-library/blocks/separator/style.css 229 B
build/block-library/blocks/separator/theme-rtl.css 194 B
build/block-library/blocks/separator/theme.css 194 B
build/block-library/blocks/shortcode/editor-rtl.css 323 B
build/block-library/blocks/shortcode/editor.css 323 B
build/block-library/blocks/site-logo/editor-rtl.css 754 B
build/block-library/blocks/site-logo/editor.css 754 B
build/block-library/blocks/site-logo/style-rtl.css 204 B
build/block-library/blocks/site-logo/style.css 204 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 116 B
build/block-library/blocks/site-title/editor.css 116 B
build/block-library/blocks/site-title/style-rtl.css 57 B
build/block-library/blocks/site-title/style.css 57 B
build/block-library/blocks/social-link/editor-rtl.css 184 B
build/block-library/blocks/social-link/editor.css 184 B
build/block-library/blocks/social-links/editor-rtl.css 676 B
build/block-library/blocks/social-links/editor.css 675 B
build/block-library/blocks/social-links/style-rtl.css 1.48 kB
build/block-library/blocks/social-links/style.css 1.48 kB
build/block-library/blocks/spacer/editor-rtl.css 350 B
build/block-library/blocks/spacer/editor.css 350 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 395 B
build/block-library/blocks/table/editor.css 395 B
build/block-library/blocks/table/style-rtl.css 639 B
build/block-library/blocks/table/style.css 639 B
build/block-library/blocks/table/theme-rtl.css 152 B
build/block-library/blocks/table/theme.css 152 B
build/block-library/blocks/tag-cloud/style-rtl.css 251 B
build/block-library/blocks/tag-cloud/style.css 253 B
build/block-library/blocks/template-part/editor-rtl.css 431 B
build/block-library/blocks/template-part/editor.css 431 B
build/block-library/blocks/template-part/theme-rtl.css 107 B
build/block-library/blocks/template-part/theme.css 107 B
build/block-library/blocks/term-description/style-rtl.css 111 B
build/block-library/blocks/term-description/style.css 111 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 99 B
build/block-library/blocks/verse/style.css 99 B
build/block-library/blocks/video/editor-rtl.css 552 B
build/block-library/blocks/video/editor.css 555 B
build/block-library/blocks/video/style-rtl.css 185 B
build/block-library/blocks/video/style.css 185 B
build/block-library/blocks/video/theme-rtl.css 133 B
build/block-library/blocks/video/theme.css 133 B
build/block-library/classic-rtl.css 179 B
build/block-library/classic.css 179 B
build/block-library/common-rtl.css 1.11 kB
build/block-library/common.css 1.11 kB
build/block-library/editor-elements-rtl.css 75 B
build/block-library/editor-elements.css 75 B
build/block-library/editor-rtl.css 12.4 kB
build/block-library/editor.css 12.4 kB
build/block-library/elements-rtl.css 54 B
build/block-library/elements.css 54 B
build/block-library/index.min.js 218 kB
build/block-library/reset-rtl.css 472 B
build/block-library/reset.css 472 B
build/block-library/style-rtl.css 14.8 kB
build/block-library/style.css 14.8 kB
build/block-library/theme-rtl.css 707 B
build/block-library/theme.css 713 B
build/block-serialization-default-parser/index.min.js 1.12 kB
build/block-serialization-spec-parser/index.min.js 2.87 kB
build/blocks/index.min.js 51.5 kB
build/commands/index.min.js 15.2 kB
build/commands/style-rtl.css 953 B
build/commands/style.css 951 B
build/components/style-rtl.css 11.9 kB
build/components/style.css 11.9 kB
build/compose/index.min.js 12.6 kB
build/core-commands/index.min.js 2.77 kB
build/core-data/index.min.js 72.5 kB
build/customize-widgets/index.min.js 11.2 kB
build/customize-widgets/style-rtl.css 1.36 kB
build/customize-widgets/style.css 1.36 kB
build/data-controls/index.min.js 640 B
build/data/index.min.js 9 kB
build/date/index.min.js 17.9 kB
build/deprecated/index.min.js 451 B
build/dom-ready/index.min.js 324 B
build/dom/index.min.js 4.65 kB
build/edit-post/classic-rtl.css 579 B
build/edit-post/classic.css 579 B
build/edit-post/index.min.js 23.6 kB
build/edit-post/style-rtl.css 5.5 kB
build/edit-post/style.css 5.5 kB
build/edit-site/index.min.js 230 kB
build/edit-site/style-rtl.css 15 kB
build/edit-site/style.css 15 kB
build/edit-widgets/index.min.js 17.7 kB
build/edit-widgets/style-rtl.css 4.16 kB
build/edit-widgets/style.css 4.16 kB
build/editor/style-rtl.css 5.49 kB
build/editor/style.css 5.48 kB
build/element/index.min.js 4.83 kB
build/escape-html/index.min.js 537 B
build/format-library/index.min.js 8.07 kB
build/format-library/style-rtl.css 493 B
build/format-library/style.css 492 B
build/hooks/index.min.js 1.55 kB
build/html-entities/index.min.js 448 B
build/i18n/index.min.js 3.58 kB
build/interactivity/debug.min.js 16.2 kB
build/interactivity/file.min.js 447 B
build/interactivity/image.min.js 1.67 kB
build/interactivity/index.min.js 13 kB
build/interactivity/navigation.min.js 1.17 kB
build/interactivity/query.min.js 740 B
build/interactivity/router.min.js 1.36 kB
build/interactivity/search.min.js 618 B
build/is-shallow-equal/index.min.js 527 B
build/keyboard-shortcuts/index.min.js 1.3 kB
build/keycodes/index.min.js 1.46 kB
build/list-reusable-blocks/index.min.js 2.11 kB
build/list-reusable-blocks/style-rtl.css 851 B
build/list-reusable-blocks/style.css 851 B
build/media-utils/index.min.js 2.92 kB
build/modules/importmap-polyfill.min.js 12.2 kB
build/notices/index.min.js 948 B
build/nux/index.min.js 1.57 kB
build/nux/style-rtl.css 748 B
build/nux/style.css 744 B
build/plugins/index.min.js 1.8 kB
build/preferences-persistence/index.min.js 2.06 kB
build/preferences/index.min.js 2.83 kB
build/preferences/style-rtl.css 710 B
build/preferences/style.css 712 B
build/primitives/index.min.js 975 B
build/priority-queue/index.min.js 1.52 kB
build/private-apis/index.min.js 1 kB
build/react-i18n/index.min.js 623 B
build/react-refresh-entry/index.min.js 9.47 kB
build/react-refresh-runtime/index.min.js 6.78 kB
build/redux-routine/index.min.js 2.7 kB
build/reusable-blocks/index.min.js 2.73 kB
build/reusable-blocks/style-rtl.css 256 B
build/reusable-blocks/style.css 256 B
build/rich-text/index.min.js 10 kB
build/router/index.min.js 1.88 kB
build/server-side-render/index.min.js 1.96 kB
build/shortcode/index.min.js 1.39 kB
build/style-engine/index.min.js 2.03 kB
build/token-list/index.min.js 582 B
build/url/index.min.js 3.74 kB
build/vendors/inert-polyfill.min.js 2.48 kB
build/vendors/react-dom.min.js 41.7 kB
build/vendors/react.min.js 4.02 kB
build/viewport/index.min.js 957 B
build/warning/index.min.js 249 B
build/widgets/index.min.js 7.23 kB
build/widgets/style-rtl.css 1.17 kB
build/widgets/style.css 1.17 kB
build/wordcount/index.min.js 1.02 kB

compressed-size-action

@jasmussen
Copy link
Contributor

Nice work, although there are some tweaks to be done here and there, this seems to have the right ingredients. Can you have a look at this one and see if that helps thread the needle? There may be some simplified name management by unifying the modal.

Copy link
Contributor

@talldan talldan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works pretty well. I left a few PR comments, mainly about the copy which could do with some adjustments.

In testing, there's one flow that doesn't seem to be covered:

  1. Create a pattern
  2. Add a paragraph
  3. Use the block options dropdown menu (either via List View or the canvas) to name a block.

You see a different UI in the modal when doing this, but still have overrides enabled after naming the block. Feels like there might be two options to solve this:

  • Show 'Allow overrides' in the dropdown instead of 'Rename', and use the same modal in all places (when editing a pattern). That way everywhere has the same flow.
  • (Or) allow the user to name block as normal, but don't enable overrides. Instead, still require the user to click 'Allow overrides' in the advanced area.

In practice, the 'Allow overrides' button that turns into a toggle also doesn't feel like the best option to me, but it seems more of a minor thing that can alway be iterated on.

@jasmussen
Copy link
Contributor

Took this one for a spin, and I'm missing a little nuance, seeing the toggle but no block name most of the time, and I wasn't able to find the naming button. It's very probably I'm doing something wrong. I would appreciate a quick review by @SaxonF

@kevin940726
Copy link
Member Author

You see a different UI in the modal when doing this, but still have overrides enabled after naming the block. Feels like there might be two options to solve this

Yeah, this is based on the assumption that naming a block automatically enables overrides. You need to "opt-out" of the feature manually after naming it (#59812). (I have multiple explorative PRs all connecting together, and I know this is kind of confusing 😅)

seeing the toggle but no block name most of the time, and I wasn't able to find the naming button.

The naming control in the advanced panel is removed by design. This also matches the proposal in #60118. This is just one possible option though and we can revisit this separately. If you can't find the rename button in the dropdown then it's likely a bug though 😅.

@SaxonF
Copy link
Contributor

SaxonF commented Apr 3, 2024

Yeah, this is based on the assumption that naming a block automatically enables overrides. You nee

I would not automatically enable syncing via renaming, at least initially. The direction this PR goes in is adding an explicit way to enable overrides (vs based on name) whilst encouraging a name change, which I think is the right approach at least in the short term. We keep the renaming action and overrides action separate, but can tie them together via the "allow overrides" button.

What do we need to do to get this over the line? I think its a big improvement over what we have and is a sensible start point. Keen to get @fabiankaegy thoughts on this too.

@talldan
Copy link
Contributor

talldan commented Apr 3, 2024

Just to flag some dependencies. I think this design direction (opt-in to block naming) has a knock on effect with this PR - Use metadata.name only as the hint for pattern overrides. I think it makes it unworkable as a solution, so it'd mean going back to the drawing board on a solution for the issue that it would have solved - Pattern Overrides: individual binding attributes are saved in the pattern markup and don't auto-update. Does that conclusion sound right, @kevin940726?

For me, it's not a blocker, but I want to be clear about what the interconnected tasks are.

@fabiankaegy
Copy link
Member

Thanks for the ping :) This tests well! Kudos to everyone involved.

I still stand by my strong opinion that the overrides toggle should not be enabled by default when a block gets renamed and instead decouple that action so that a user has to specifically opt-in.

Besides that I noticed a few rough edges:

  • When a block is already named before the pattern gets created, it isn't editable in the instance till I reload the page. Seems the instance overrides are not initialized on pattern creation.
  • When a block already has a name & overrides enabled the block name setting is completely removed from the Advanced Settings and only reachable through the block context menu. I think this is confusing. I think the flow @jasmussen created here Pattern Overrides: Improve the UI clarity for using named overrides #59813 (comment) would work better for this
  • I'm also getting an error on this branch whenever I try to select a group block that is for example coming from tt4 which uses the pattern shuffling experiment. Not sure whether that is related.
@kevin940726 kevin940726 changed the base branch from update/pattern-overrides-opt-out to trunk April 3, 2024 10:52
@kevin940726 kevin940726 force-pushed the update/pattern-overrides-rename-ui branch 2 times, most recently from d48f797 to 5e8be30 Compare April 3, 2024 11:45
@SaxonF
Copy link
Contributor

SaxonF commented Apr 3, 2024

When a block already has a name & overrides enabled the block name setting is completely removed from the Advanced Settings and only reachable through the block context menu. I think this is confusing.

@fabiankaegy The block name was removed completely from the advanced panel so not just when override is enabled. See #60118 (comment) . There are a couple reasons for this that the issue touches on but the one related to this work is that renaming has the side effect of resetting instances that already override the block. This is a destructive action which is hard to provide guardrails around if its simply an input within the inspector with no confirm action.

The other main purpose of this exploration is clearly separating "rename" and "allow overrides" actions, hence not including toggle within the rename modal. Rename modal can be consistent whether its used in the source or on a random block in the editor. Relabelling the initial "allow overrides" button in the inspector to "set up overrides..." which triggers the "set up overrides" modal may help clarify why it turns to a toggle.

@fabiankaegy
Copy link
Member

@SaxonF thanks for those insights. I wonder whether completely disabling the rename field may be a better solution. Removing it makes it seem like there is a bug

@kevin940726
Copy link
Member Author

I updated the branch to add an "Allow overrides" toggle in the renaming modal when editing inside a pattern. I also made the toggle "opt-in" instead of opt-out to avoid some of the issues mentioned above.

Kapture.2024-04-03.at.18.47.52.mp4

Note

The code for pattern overrides probably shouldn't belong in the block-editor package. But for the sake of this exploration, I decided to refactor that in a future follow-up once we can confirm the design UX.

@SaxonF
Copy link
Contributor

SaxonF commented Apr 3, 2024

@fabiankaegy the name field shouldn't be there at all , are you seeing it visible on this branch in some cases? Consider removing block name from advanced a completely separate issue that also benefits this work .

@SaxonF
Copy link
Contributor

SaxonF commented Apr 3, 2024

@kevin940726 as noted above, I'm not convinced we need the overrides toggle in the rename modal and would prefer to keep rename and overrides separate actions for now. If we get feedback that people are looking for overrides in rename or related we can reassess.

@fabiankaegy
Copy link
Member

@fabiankaegy the name field shouldn't be there at all , are you seeing it visible on this branch in some cases? Consider removing block name from advanced a completely separate issue that also benefits this work .

The name field is visible in the advanced section of any block as of WordPress 6.5. I think that this ship has sailed. I would be very careful about removing it again from there because users are now getting used to it and I think it would be quite disruptive to remove it again.

@jasmussen
Copy link
Contributor

Just chatted with Saxon about the feedback here, to better understand some of the path being explored in this PR. The short summary revolves around these two points:

  1. Removing the block name field from the Advanced section.
  2. The approach to "setting up block overrides".

I'll dive in with more details from that chat, but do it over a quick visual of the current state of this branch, with some points intermixed as feedback. GIF:
branch

The GIF shows editing a synced pattern, selecting an image, then clicking the "Allow overrides" button.

This button is meant to be a "setup" feature for setting up overrides. The motivation here is that allowing parts of the pattern is a bit of an advanced flow, so the modal can provide contet.

But as soon as a user-supplied name is provided, then the "allow overrides" just becomes a toggle.

Separately I try to rename a group block, just in the list view — turns out there's a bug there, the name for the group block is not reflected in the inspector.

Naming

Unpacking this — the block needs a name when overridden. Moving this into the modal invoked by the "Allow overrides" button makes it possible to provide context for why it needs a name.

There's also just the ergonimics of renaming a group block, without enabling any overrides. This is a purely cosmetic change that is visible primarily in the list view. Here's an example of the 6.5 release site structure:

6-5-release-site-list-view

Every module in that page is a Group block, and with a lot of content to build and edit, those cosmetics provide a meaingful overview and navigational affordance for anyone editing. But only really, in the list view. And since that's also the primary interface for renaming (ellipsis menu > rename), the fact that you can rename also in the Advanced section, is a little duplicative.

To that end, I can get behind the idea of removing the block name from the advanced section, and having that ellipsis menu be the primary place where you do that.

So I can be on board with this PR as a step forward: having the button to initially provide a name for overrides makes sense. Removing the block name from advanced, also makes sense. There may be room to revisit the toggle that appears afterwards could be something to explore, but as-is it does provide a simple way to at a glance tell whether something is overridable or not, so it seems worth trying.

Next steps

Based on the above, I'd suggest the following. Firstly, to fix the bug where you can't rename a group block — not sure why that broke.

Separately, let's massage these modals:

allow overrides
rename
rename with override warning

Those last two are the same modal, the latter just has a contextual warning for when the the block allows overrides. Let's remove the checkbox and make them look more alike. A suggestion for the above three:

Modal tweaks
@fabiankaegy
Copy link
Member

Thanks @jasmussen and @SaxonF :) That overview is very helpful.

I stand by my comment from a moment ago in that I think it would be a wiser choice to disable the name field in the advanced section when overrides are active and maybe trigger the modal when a user attempts to click on it instead of removing it altogether.

Besides that one detail, I really think this flow that you are outlining is going to work very well :)

@SaxonF
Copy link
Contributor

SaxonF commented Apr 3, 2024

@fabiankaegy i don't see removing name input as a blocker for this work so could just provide warning text under input in short term and discuss name field in Rich's separate issue.

@fabiankaegy
Copy link
Member

Also added a comment to the ticket you mentioned #60118 (comment)

I think taking it out of this PR and then seeing whether we can come up with an alternative before we remove it altogether would be better. But I won't block progress here :) We have some time before the next WP core release to get this right

@richtabor
Copy link
Member

@fabiankaegy i don't see removing name input as a blocker for this work so could just provide warning text under input in short term and discuss name field in Rich's separate issue.

Agreed.

maybe trigger the modal when a user attempts to click on it instead of removing it altogether.

We shouldn't trigger a model on input selection. And I also don't think having an input that is sometimes there, isn't ideal.

I do think the Advanced panel is more confusing having the name input there, where it's largely irrelevant (you rename for List View). But let's carry on that conversation in #60118

@fabiankaegy
Copy link
Member

@richtabor i wonder whether it should have the purple color at all. Because the purple is always meant to represent global elements. And the override is exactly the opposite 🤔😅

@richtabor
Copy link
Member

We can certainly iterate from here, but I did note that it's unexpected to have two different interactions for enabling and disabling overrides, and especially two different interactions for enabling.

Can we simplify to this below (don't mind the actual design metrics, but the flow):

CleanShot.2024-04-10.at.12.31.44.mp4

Removing the connection between metadata.name and the UI changing from a button to a toggle (removing the toggle altogether). Even if my block has a metadata.name value, I should still see the same "Allow overrides" button.

I click "Allow overrides" and a modal renders with the name field. I am required to add a name if there is not one. If one already exists, I see it in the input field already.

I select "Allow overrides" to confirm my override. When I press "Allow overrides" on the modal, the binding is applied—just like when I first created a binding initially.

Now I see the secondary button in the Inspector, but it renders "Disable overrides".

When I select that button, I see a "Disable overrides" modal to confirm my decision. The help text should state what will happen to my existing overrides. There is no name field on this modal. When I press "Disable overrides" on the modal, the binding is removed.

@richtabor
Copy link
Member

richtabor commented Apr 10, 2024

@richtabor i wonder whether it should have the purple color at all. Because the purple is always meant to represent global elements. And the override is exactly the opposite 🤔😅

Yea, perhaps that doesn't work 1:1. Thoughts on using purple for bindings/overrides @jameskoster?

I suppose this is where bindings and overrides gets muddied a bit. As blocks with bounded attributes have values derived from "elsewhere"—whether or not that's "global" is another question.

@jameskoster
Copy link
Contributor

Agree it's not perfect, but on balance I don't mind it too much because parts of the block are still synced (styles). Worth noting perhaps that overrideable layers in Figma's component instances are always purple.

That said, maybe the icon remains purple until there's an override, and then switches to the regular color. Could be worth a try? I worry it will be tricky to keep track of all this color changing though, across list view, inspector panel(s), etc.

@SaxonF
Copy link
Contributor

SaxonF commented Apr 10, 2024

@richtabor if we feel the button communicates both state and action (enabled and disable) then I'm fine with that approach.

@SaxonF
Copy link
Contributor

SaxonF commented Apr 10, 2024

Using colour only to indicate whether a block has been overridden will be an accessibility issue. If we can establish a common pattern we can use for styles (locally set vs global) and blocks that would be preferable. Eg a dot to indicate a change

@richtabor
Copy link
Member

@richtabor if we feel the button communicates both state and action (enabled and disable) then I'm fine with that approach.

I think it's fine yea.

@kevin940726 kevin940726 force-pushed the update/pattern-overrides-rename-ui branch from bb54d78 to 934c753 Compare April 11, 2024 05:41
@kevin940726
Copy link
Member Author

I think either the binding attribute needs to be removed when removing a name (which might be preferable), or some of the code elsewhere is updated to consider a block overridable only when it has the bindings attribute and a name.

This is fixed in isOverridableBlock to also check for metadata.name. This better matches what we want in #58601.

Copy link
Contributor

@talldan talldan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is working well for me. I'd be keen to get this merged to unblock other work and then follow-up on any of the smaller parts that may need to be changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) Needs Design Feedback Needs general design feedback. [Type] Enhancement A suggestion for improvement.
7 participants