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

Post Navigation Link: Add border and spacing block support #64258

Open
wants to merge 21 commits into
base: trunk
Choose a base branch
from

Conversation

akasunil
Copy link
Member

@akasunil akasunil commented Aug 5, 2024

What?

Add border and spacing block support to the Post Navigation Link block.

Part of #43247
Part of #43243

Why?

Post Navigation Link block is missing border and spacing support.

How?

Adds the border and spacing block support in block.json

Testing Instructions

  • Go to Global Styles setting ( under appearance > editor > styles > edit styles > blocks )
  • Make sure that Post Navigation Link block's border and spacing is configurable via Global Styles
  • Verify that Global Styles are applied correctly in the editor and frontend
  • Edit template/page, Add Post Navigation Link block and Apply the border and spacing styles
  • Verify that block styles take precedence over global styles
  • Verify that block styles display correctly in both the editor and frontend

Watch attached video for more information.

Screenshots or screencast

Single-Posts-.-Template-.-gutenberg-.-Editor-.-WordPress.webm

@akasunil akasunil added [Type] Enhancement A suggestion for improvement. [Block] Post Navigation Link Affects the Post Navigation Link Block labels Aug 5, 2024
Copy link

github-actions bot commented Aug 5, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: akasunil <sunil25393@git.wordpress.org>
Co-authored-by: ramonjd <ramonopoly@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: aaronrobertshaw <aaronrobertshaw@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link

github-actions bot commented Aug 5, 2024

Size Change: +121 B (+0.01%)

Total Size: 1.77 MB

Filename Size Change
build/block-library/blocks/post-navigation-link/style-rtl.css 230 B +15 B (+6.98%) 🔍
build/block-library/blocks/post-navigation-link/style.css 230 B +16 B (+7.48%) 🔍
build/block-library/index.min.js 220 kB +80 B (+0.04%)
build/block-library/style-rtl.css 14.9 kB +6 B (+0.04%)
build/block-library/style.css 14.9 kB +4 B (+0.03%)
ℹ️ View Unchanged
Filename Size
build-module/a11y/index.min.js 482 B
build-module/block-library/file/view.min.js 447 B
build-module/block-library/image/view.min.js 1.78 kB
build-module/block-library/navigation/view.min.js 1.16 kB
build-module/block-library/query/view.min.js 742 B
build-module/block-library/search/view.min.js 616 B
build-module/interactivity-router/index.min.js 3.03 kB
build-module/interactivity/debug.min.js 17.2 kB
build-module/interactivity/index.min.js 13.6 kB
build/a11y/index.min.js 952 B
build/annotations/index.min.js 2.26 kB
build/api-fetch/index.min.js 2.32 kB
build/autop/index.min.js 2.12 kB
build/blob/index.min.js 579 B
build/block-directory/index.min.js 7.26 kB
build/block-directory/style-rtl.css 1 kB
build/block-directory/style.css 1 kB
build/block-editor/content-rtl.css 4.46 kB
build/block-editor/content.css 4.45 kB
build/block-editor/default-editor-styles-rtl.css 394 B
build/block-editor/default-editor-styles.css 394 B
build/block-editor/index.min.js 255 kB
build/block-editor/style-rtl.css 15.3 kB
build/block-editor/style.css 15.3 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 149 B
build/block-library/blocks/audio/editor.css 151 B
build/block-library/blocks/audio/style-rtl.css 132 B
build/block-library/blocks/audio/style.css 132 B
build/block-library/blocks/audio/theme-rtl.css 134 B
build/block-library/blocks/audio/theme.css 134 B
build/block-library/blocks/avatar/editor-rtl.css 115 B
build/block-library/blocks/avatar/editor.css 115 B
build/block-library/blocks/avatar/style-rtl.css 104 B
build/block-library/blocks/avatar/style.css 104 B
build/block-library/blocks/button/editor-rtl.css 265 B
build/block-library/blocks/button/editor.css 265 B
build/block-library/blocks/button/style-rtl.css 538 B
build/block-library/blocks/button/style.css 538 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 345 B
build/block-library/blocks/buttons/style.css 345 B
build/block-library/blocks/calendar/style-rtl.css 240 B
build/block-library/blocks/calendar/style.css 240 B
build/block-library/blocks/categories/editor-rtl.css 132 B
build/block-library/blocks/categories/editor.css 131 B
build/block-library/blocks/categories/style-rtl.css 152 B
build/block-library/blocks/categories/style.css 152 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 139 B
build/block-library/blocks/code/style.css 139 B
build/block-library/blocks/code/theme-rtl.css 122 B
build/block-library/blocks/code/theme.css 122 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 420 B
build/block-library/blocks/columns/style.css 420 B
build/block-library/blocks/comment-author-avatar/editor-rtl.css 124 B
build/block-library/blocks/comment-author-avatar/editor.css 124 B
build/block-library/blocks/comment-author-name/style-rtl.css 72 B
build/block-library/blocks/comment-author-name/style.css 72 B
build/block-library/blocks/comment-content/style-rtl.css 120 B
build/block-library/blocks/comment-content/style.css 120 B
build/block-library/blocks/comment-date/style-rtl.css 65 B
build/block-library/blocks/comment-date/style.css 65 B
build/block-library/blocks/comment-edit-link/style-rtl.css 70 B
build/block-library/blocks/comment-edit-link/style.css 70 B
build/block-library/blocks/comment-reply-link/style-rtl.css 71 B
build/block-library/blocks/comment-reply-link/style.css 71 B
build/block-library/blocks/comment-template/style-rtl.css 200 B
build/block-library/blocks/comment-template/style.css 199 B
build/block-library/blocks/comments-pagination-numbers/editor-rtl.css 122 B
build/block-library/blocks/comments-pagination-numbers/editor.css 121 B
build/block-library/blocks/comments-pagination/editor-rtl.css 228 B
build/block-library/blocks/comments-pagination/editor.css 217 B
build/block-library/blocks/comments-pagination/style-rtl.css 234 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 832 B
build/block-library/blocks/comments/editor.css 832 B
build/block-library/blocks/comments/style-rtl.css 632 B
build/block-library/blocks/comments/style.css 631 B
build/block-library/blocks/cover/editor-rtl.css 641 B
build/block-library/blocks/cover/editor.css 642 B
build/block-library/blocks/cover/style-rtl.css 1.64 kB
build/block-library/blocks/cover/style.css 1.63 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 331 B
build/block-library/blocks/embed/editor.css 331 B
build/block-library/blocks/embed/style-rtl.css 419 B
build/block-library/blocks/embed/style.css 419 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 326 B
build/block-library/blocks/file/style-rtl.css 278 B
build/block-library/blocks/file/style.css 279 B
build/block-library/blocks/footnotes/style-rtl.css 198 B
build/block-library/blocks/footnotes/style.css 197 B
build/block-library/blocks/form-input/editor-rtl.css 229 B
build/block-library/blocks/form-input/editor.css 229 B
build/block-library/blocks/form-input/style-rtl.css 357 B
build/block-library/blocks/form-input/style.css 357 B
build/block-library/blocks/form-submission-notification/editor-rtl.css 344 B
build/block-library/blocks/form-submission-notification/editor.css 341 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 470 B
build/block-library/blocks/freeform/editor-rtl.css 2.6 kB
build/block-library/blocks/freeform/editor.css 2.6 kB
build/block-library/blocks/gallery/editor-rtl.css 946 B
build/block-library/blocks/gallery/editor.css 951 B
build/block-library/blocks/gallery/style-rtl.css 1.83 kB
build/block-library/blocks/gallery/style.css 1.82 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 334 B
build/block-library/blocks/group/editor.css 334 B
build/block-library/blocks/group/style-rtl.css 103 B
build/block-library/blocks/group/style.css 103 B
build/block-library/blocks/group/theme-rtl.css 79 B
build/block-library/blocks/group/theme.css 79 B
build/block-library/blocks/heading/style-rtl.css 188 B
build/block-library/blocks/heading/style.css 188 B
build/block-library/blocks/html/editor-rtl.css 346 B
build/block-library/blocks/html/editor.css 347 B
build/block-library/blocks/image/editor-rtl.css 785 B
build/block-library/blocks/image/editor.css 787 B
build/block-library/blocks/image/style-rtl.css 1.59 kB
build/block-library/blocks/image/style.css 1.59 kB
build/block-library/blocks/image/theme-rtl.css 137 B
build/block-library/blocks/image/theme.css 137 B
build/block-library/blocks/latest-comments/style-rtl.css 355 B
build/block-library/blocks/latest-comments/style.css 354 B
build/block-library/blocks/latest-posts/editor-rtl.css 179 B
build/block-library/blocks/latest-posts/editor.css 179 B
build/block-library/blocks/latest-posts/style-rtl.css 509 B
build/block-library/blocks/latest-posts/style.css 510 B
build/block-library/blocks/list/style-rtl.css 107 B
build/block-library/blocks/list/style.css 107 B
build/block-library/blocks/loginout/style-rtl.css 61 B
build/block-library/blocks/loginout/style.css 61 B
build/block-library/blocks/media-text/editor-rtl.css 321 B
build/block-library/blocks/media-text/editor.css 320 B
build/block-library/blocks/media-text/style-rtl.css 558 B
build/block-library/blocks/media-text/style.css 556 B
build/block-library/blocks/more/editor-rtl.css 427 B
build/block-library/blocks/more/editor.css 427 B
build/block-library/blocks/navigation-link/editor-rtl.css 644 B
build/block-library/blocks/navigation-link/editor.css 645 B
build/block-library/blocks/navigation-link/style-rtl.css 192 B
build/block-library/blocks/navigation-link/style.css 191 B
build/block-library/blocks/navigation-submenu/editor-rtl.css 295 B
build/block-library/blocks/navigation-submenu/editor.css 294 B
build/block-library/blocks/navigation/editor-rtl.css 2.2 kB
build/block-library/blocks/navigation/editor.css 2.2 kB
build/block-library/blocks/navigation/style-rtl.css 2.25 kB
build/block-library/blocks/navigation/style.css 2.23 kB
build/block-library/blocks/nextpage/editor-rtl.css 392 B
build/block-library/blocks/nextpage/editor.css 392 B
build/block-library/blocks/page-list/editor-rtl.css 378 B
build/block-library/blocks/page-list/editor.css 378 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 236 B
build/block-library/blocks/paragraph/editor.css 236 B
build/block-library/blocks/paragraph/style-rtl.css 341 B
build/block-library/blocks/paragraph/style.css 340 B
build/block-library/blocks/post-author-biography/style-rtl.css 74 B
build/block-library/blocks/post-author-biography/style.css 74 B
build/block-library/blocks/post-author-name/style-rtl.css 69 B
build/block-library/blocks/post-author-name/style.css 69 B
build/block-library/blocks/post-author/editor-rtl.css 107 B
build/block-library/blocks/post-author/editor.css 107 B
build/block-library/blocks/post-author/style-rtl.css 188 B
build/block-library/blocks/post-author/style.css 189 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 527 B
build/block-library/blocks/post-comments-form/style.css 528 B
build/block-library/blocks/post-content/style-rtl.css 61 B
build/block-library/blocks/post-content/style.css 61 B
build/block-library/blocks/post-date/style-rtl.css 62 B
build/block-library/blocks/post-date/style.css 62 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 155 B
build/block-library/blocks/post-excerpt/style.css 155 B
build/block-library/blocks/post-featured-image/editor-rtl.css 729 B
build/block-library/blocks/post-featured-image/editor.css 726 B
build/block-library/blocks/post-featured-image/style-rtl.css 347 B
build/block-library/blocks/post-featured-image/style.css 347 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 399 B
build/block-library/blocks/post-template/style.css 398 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 70 B
build/block-library/blocks/post-time-to-read/style.css 70 B
build/block-library/blocks/post-title/style-rtl.css 162 B
build/block-library/blocks/post-title/style.css 162 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 134 B
build/block-library/blocks/pullquote/editor.css 134 B
build/block-library/blocks/pullquote/style-rtl.css 342 B
build/block-library/blocks/pullquote/style.css 342 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 121 B
build/block-library/blocks/query-pagination-numbers/editor.css 118 B
build/block-library/blocks/query-pagination/editor-rtl.css 154 B
build/block-library/blocks/query-pagination/editor.css 154 B
build/block-library/blocks/query-pagination/style-rtl.css 237 B
build/block-library/blocks/query-pagination/style.css 237 B
build/block-library/blocks/query-title/style-rtl.css 64 B
build/block-library/blocks/query-title/style.css 64 B
build/block-library/blocks/query/editor-rtl.css 452 B
build/block-library/blocks/query/editor.css 451 B
build/block-library/blocks/quote/style-rtl.css 238 B
build/block-library/blocks/quote/style.css 238 B
build/block-library/blocks/quote/theme-rtl.css 233 B
build/block-library/blocks/quote/theme.css 236 B
build/block-library/blocks/read-more/style-rtl.css 138 B
build/block-library/blocks/read-more/style.css 138 B
build/block-library/blocks/rss/editor-rtl.css 101 B
build/block-library/blocks/rss/editor.css 101 B
build/block-library/blocks/rss/style-rtl.css 288 B
build/block-library/blocks/rss/style.css 287 B
build/block-library/blocks/search/editor-rtl.css 199 B
build/block-library/blocks/search/editor.css 199 B
build/block-library/blocks/search/style-rtl.css 672 B
build/block-library/blocks/search/style.css 671 B
build/block-library/blocks/search/theme-rtl.css 113 B
build/block-library/blocks/search/theme.css 113 B
build/block-library/blocks/separator/editor-rtl.css 100 B
build/block-library/blocks/separator/editor.css 100 B
build/block-library/blocks/separator/style-rtl.css 248 B
build/block-library/blocks/separator/style.css 248 B
build/block-library/blocks/separator/theme-rtl.css 195 B
build/block-library/blocks/separator/theme.css 195 B
build/block-library/blocks/shortcode/editor-rtl.css 286 B
build/block-library/blocks/shortcode/editor.css 286 B
build/block-library/blocks/site-logo/editor-rtl.css 806 B
build/block-library/blocks/site-logo/editor.css 803 B
build/block-library/blocks/site-logo/style-rtl.css 218 B
build/block-library/blocks/site-logo/style.css 218 B
build/block-library/blocks/site-tagline/editor-rtl.css 87 B
build/block-library/blocks/site-tagline/editor.css 87 B
build/block-library/blocks/site-tagline/style-rtl.css 65 B
build/block-library/blocks/site-tagline/style.css 65 B
build/block-library/blocks/site-title/editor-rtl.css 85 B
build/block-library/blocks/site-title/editor.css 85 B
build/block-library/blocks/site-title/style-rtl.css 143 B
build/block-library/blocks/site-title/style.css 143 B
build/block-library/blocks/social-link/editor-rtl.css 338 B
build/block-library/blocks/social-link/editor.css 338 B
build/block-library/blocks/social-links/editor-rtl.css 729 B
build/block-library/blocks/social-links/editor.css 727 B
build/block-library/blocks/social-links/style-rtl.css 1.51 kB
build/block-library/blocks/social-links/style.css 1.5 kB
build/block-library/blocks/spacer/editor-rtl.css 346 B
build/block-library/blocks/spacer/editor.css 346 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-of-contents/style-rtl.css 83 B
build/block-library/blocks/table-of-contents/style.css 83 B
build/block-library/blocks/table/editor-rtl.css 394 B
build/block-library/blocks/table/editor.css 394 B
build/block-library/blocks/table/style-rtl.css 640 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/editor-rtl.css 144 B
build/block-library/blocks/tag-cloud/editor.css 144 B
build/block-library/blocks/tag-cloud/style-rtl.css 266 B
build/block-library/blocks/tag-cloud/style.css 265 B
build/block-library/blocks/template-part/editor-rtl.css 368 B
build/block-library/blocks/template-part/editor.css 368 B
build/block-library/blocks/template-part/theme-rtl.css 113 B
build/block-library/blocks/template-part/theme.css 113 B
build/block-library/blocks/term-description/style-rtl.css 126 B
build/block-library/blocks/term-description/style.css 126 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 165 B
build/block-library/blocks/text-columns/style.css 165 B
build/block-library/blocks/verse/style-rtl.css 98 B
build/block-library/blocks/verse/style.css 98 B
build/block-library/blocks/video/editor-rtl.css 396 B
build/block-library/blocks/video/editor.css 397 B
build/block-library/blocks/video/style-rtl.css 192 B
build/block-library/blocks/video/style.css 192 B
build/block-library/blocks/video/theme-rtl.css 134 B
build/block-library/blocks/video/theme.css 134 B
build/block-library/classic-rtl.css 179 B
build/block-library/classic.css 179 B
build/block-library/common-rtl.css 1.08 kB
build/block-library/common.css 1.08 kB
build/block-library/editor-elements-rtl.css 75 B
build/block-library/editor-elements.css 75 B
build/block-library/editor-rtl.css 11.7 kB
build/block-library/editor.css 11.7 kB
build/block-library/elements-rtl.css 54 B
build/block-library/elements.css 54 B
build/block-library/reset-rtl.css 472 B
build/block-library/reset.css 472 B
build/block-library/theme-rtl.css 708 B
build/block-library/theme.css 712 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 52.5 kB
build/commands/index.min.js 16.1 kB
build/commands/style-rtl.css 955 B
build/commands/style.css 952 B
build/components/index.min.js 227 kB
build/components/style-rtl.css 12.4 kB
build/components/style.css 12.4 kB
build/compose/index.min.js 12.7 kB
build/core-commands/index.min.js 3.11 kB
build/core-data/index.min.js 73.4 kB
build/customize-widgets/index.min.js 11 kB
build/customize-widgets/style-rtl.css 1.35 kB
build/customize-widgets/style.css 1.35 kB
build/data-controls/index.min.js 641 B
build/data/index.min.js 8.97 kB
build/date/index.min.js 18 kB
build/deprecated/index.min.js 458 B
build/dom-ready/index.min.js 325 B
build/dom/index.min.js 4.66 kB
build/edit-post/classic-rtl.css 578 B
build/edit-post/classic.css 580 B
build/edit-post/index.min.js 13.7 kB
build/edit-post/style-rtl.css 2.76 kB
build/edit-post/style.css 2.75 kB
build/edit-site/index.min.js 218 kB
build/edit-site/posts-rtl.css 7.32 kB
build/edit-site/posts.css 7.32 kB
build/edit-site/style-rtl.css 12.6 kB
build/edit-site/style.css 12.6 kB
build/edit-widgets/index.min.js 17.7 kB
build/edit-widgets/style-rtl.css 4.19 kB
build/edit-widgets/style.css 4.19 kB
build/editor/index.min.js 103 kB
build/editor/style-rtl.css 9.37 kB
build/editor/style.css 9.38 kB
build/element/index.min.js 4.82 kB
build/escape-html/index.min.js 537 B
build/format-library/index.min.js 8.04 kB
build/format-library/style-rtl.css 476 B
build/format-library/style.css 476 B
build/hooks/index.min.js 1.65 kB
build/html-entities/index.min.js 445 B
build/i18n/index.min.js 3.58 kB
build/is-shallow-equal/index.min.js 526 B
build/keyboard-shortcuts/index.min.js 1.31 kB
build/keycodes/index.min.js 1.46 kB
build/list-reusable-blocks/index.min.js 2.13 kB
build/list-reusable-blocks/style-rtl.css 852 B
build/list-reusable-blocks/style.css 852 B
build/media-utils/index.min.js 3.2 kB
build/notices/index.min.js 946 B
build/nux/index.min.js 1.62 kB
build/nux/style-rtl.css 749 B
build/nux/style.css 745 B
build/patterns/index.min.js 7.34 kB
build/patterns/style-rtl.css 687 B
build/patterns/style.css 685 B
build/plugins/index.min.js 1.81 kB
build/preferences-persistence/index.min.js 2.06 kB
build/preferences/index.min.js 2.9 kB
build/preferences/style-rtl.css 554 B
build/preferences/style.css 554 B
build/primitives/index.min.js 829 B
build/priority-queue/index.min.js 1.54 kB
build/private-apis/index.min.js 960 B
build/react-i18n/index.min.js 630 B
build/react-refresh-entry/index.min.js 9.47 kB
build/react-refresh-runtime/index.min.js 6.76 kB
build/redux-routine/index.min.js 2.7 kB
build/reusable-blocks/index.min.js 2.55 kB
build/reusable-blocks/style-rtl.css 256 B
build/reusable-blocks/style.css 256 B
build/rich-text/index.min.js 10.1 kB
build/router/index.min.js 1.96 kB
build/server-side-render/index.min.js 1.94 kB
build/shortcode/index.min.js 1.4 kB
build/style-engine/index.min.js 2.04 kB
build/token-list/index.min.js 581 B
build/url/index.min.js 3.9 kB
build/vendors/react-dom.min.js 41.7 kB
build/vendors/react-jsx-runtime.min.js 556 B
build/vendors/react.min.js 4.02 kB
build/viewport/index.min.js 965 B
build/warning/index.min.js 250 B
build/widgets/index.min.js 7.16 kB
build/widgets/style-rtl.css 1.16 kB
build/widgets/style.css 1.16 kB
build/wordcount/index.min.js 1.03 kB

compressed-size-action

@ramonjd
Copy link
Member

ramonjd commented Aug 7, 2024

This will also style empty post navigation elements, e.g., <div class="post-navigation-link-next wp-block-post-navigation-link"></div>

Screenshot 2024-08-07 at 12 03 54 PM

I'm not sure what the appropriate approach would be.

Adding a selector with :not(:empty) works for global styles, but not for block-level, inline styles.

diff --git a/packages/block-library/src/post-navigation-link/block.json b/packages/block-library/src/post-navigation-link/block.json
index 3972236599..3480bbad6a 100644
--- a/packages/block-library/src/post-navigation-link/block.json
+++ b/packages/block-library/src/post-navigation-link/block.json
@@ -71,5 +71,8 @@
 			}
 		}
 	},
+	"selectors": {
+		"border": ".wp-block-post-navigation-link:not(:empty)"
+	},
 	"style": "wp-block-post-navigation-link"
 }

I guess skipping serialization and only applying the style if a link exists would be the cleanest way since other styles like typography, while not noticeable, would not be applied at all on the empty element.

It would be good to get @aaronrobertshaw's opinion.

@t-hamano
Copy link
Contributor

t-hamano commented Aug 7, 2024

Maybe the underlying problem is that the wrapper element is being rendered even though no links exist?

I think we could solve that by adding an early return if there are no links in the render callback function.

However, we might need a style like this to ensure that the next link is right-justified even when the previous link doesn't exist.

@ramonjd
Copy link
Member

ramonjd commented Aug 7, 2024

However, we might need a style like this to ensure that the next link is right-justified even when the previous link doesn't exist.

I thought of that but wasn't sure how important the empty element is to the structure of the block.

Not rendering it at all would be the best, for sure. 👍🏻

@akasunil
Copy link
Member Author

akasunil commented Aug 7, 2024

Another option is that, We can apply styles to link tag only

"selectors": {
    "border": ".wp-block-post-navigation-link > a"
},

With this, we could avoid the miss-representation like below. Its looks like that button but only link is clickable. which would be confusing from user point of view.

Hello-world-.-gutenberg.webm

@ramonjd
Copy link
Member

ramonjd commented Aug 7, 2024

With this, we could avoid the miss-representation like below. Its looks like that button but only link is clickable. which would be confusing from user point of view.

That could be an option.

One thing is that the link is a sub-element of the block, and I think the styles should apply to the entire block consistently.

If we target <a /> the styles won't wrap the arrow element.

Screenshot 2024-08-07 at 3 18 22 PM

That's just my opinion. 😄

@akasunil
Copy link
Member Author

akasunil commented Aug 7, 2024

If we target <a /> the styles won't wrap the arrow element.

Right.

Not rendering it at all would be the best, for sure. 👍🏻

Should we handle this in separate PR or in this PR?

@t-hamano
Copy link
Contributor

t-hamano commented Aug 7, 2024

Another option is that, We can apply styles to link tag only
With this, we could avoid the miss-representation like below. Its looks like that button but only link is clickable. which would be confusing from user point of view.

Good point, I also expressed concern about this problem in this comment.

"selectors": {
    "border": ".wp-block-post-navigation-link > a"
},

However, this approach runs into problems when a background is applied, because the background is applied to the block itself:

image

To solve this problem, we would need to skip serialization of both color support and border support and write a lot of JS/PHP code.

I think the styles should apply to the entire block consistently.

I am leaning towards agreeing with this approach.

Not rendering it at all would be the best, for sure. 👍🏻
Should we handle this in separate PR or in this PR?

I think it's okay to include it in this PR.

// Return empty if the adjacent post is unavailable.
if ( empty( $content ) ) {
return '';
}
Copy link
Member

Choose a reason for hiding this comment

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

This looks right to me so far. Thank you for the changes! 🙇🏻

There's one backwards compatibility case that @t-hamano already mentioned: without the "empty" block wrapper, the next navigation block will align left.

We might have to think about RTL languages too, so the "previous" block should align left? Not sure there, but we should test it.

Not sure what the best thing to do here - probably CSS as @t-hamano suggests.

Here's the difference I see.

T4 in trunk

Screenshot 2024-08-08 at 9 56 38 AM

T4 with this PR

Screenshot 2024-08-08 at 9 56 21 AM

Copy link
Contributor

Choose a reason for hiding this comment

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

This code looks good to me too 👍

without the "empty" block wrapper, the next navigation block will align left.

This needs to be addressed. By using maring-inline-{start|end}, we should be able to handle RTL languages ​​as well as LTR languages.

A similar approach has been attempted for the Query Pagination block, and these two PRs may be of help:

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure that simply removing the empty element solves all the backward compatibility issues here.

Removing the element and adding CSS may prevent visual regressions for the default situation. There might be use cases out in the wild though where changing the block's markup breaks other theme styles.

We can avoid all BC issues by only applying the styles when needed. I don't think it's a resource-intensive option and saves having to send additional CSS.

Copy link
Member

Choose a reason for hiding this comment

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

We can avoid all BC issues by only applying the styles when needed. I don't think it's a resource-intensive option and saves having to send additional CSS.

I agree that preserving the element would be the ideal approach. Some themes might expecting the element to be there for styling or structural purposes.

I wonder how it'd work with global styles, presets etc. Should we strip all classnames and styles from the element?

Then there's the issue of whether themes are relying on these classnames as hooks. 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder how it'd work with global styles, presets etc. Should we strip all classnames and styles from the element?

Leveraging the Block Selectors API, we should be able to use something like the :empty pseudo selector in combination with :not() to ensure the Global Styles are only applied when they should be.

Completely untested example: .wp-block-post-navigation-link:not(:empty).

I've recently used a loosely similar approach to ensuring List and List Item global styles are only applied to top-level blocks rather than nested lists.

Copy link
Member

Choose a reason for hiding this comment

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

Good idea! Thanks for confirming.

So maybe my first comment wasn't so wild as I thought. 🤣

Copy link
Contributor

Choose a reason for hiding this comment

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

That or we're both just wild. Either way, they say great minds think alike 🤔

I completely forgot you'd already mentioned that selector sorry. I'm a bit slow sometimes.

Still, a combination of skipping serialization of the block supports, as necessary, with the custom global styles selector works for me.

Copy link
Contributor

@aaronrobertshaw aaronrobertshaw left a comment

Choose a reason for hiding this comment

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

Thanks for putting this PR together and the iterations on it so far 👍

I've given this a smoke test as well and it is working generally as I'd expect.

✅ Global styles apply in both editor and frontend
✅ Block instance styles override the Global Styles
✅ Box sizing allows parent-enforced width to be honored

While looking at the code changes, I had a couple of questions.

  • Does it make sense to add border support without spacing support as well?
    • It's hard to see a use case where a border right up against the text is desired
  • Does the removal of the empty element actually solve the backwards compatibility issue?
    • It does get the end result to look the same
    • I wonder though if themes may already have styles targeting these navigation links that assume the presence of the empty element e.g. those targeting :first-child etc.
    • Has the pattern directory been looked through for potential cases where removing the empty element may cause an issue?
    • It is pretty simple to skip serialization and only apply those styles when the element isn't empty. Might that be better than shiping more CSS?

Comment on lines 66 to 71
"__experimentalDefaultControls": {
"radius": true,
"color": true,
"width": true,
"style": true
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"__experimentalDefaultControls": {
"radius": true,
"color": true,
"width": true,
"style": true
}

The prevailing design feedback lately has been for nice applications of border support to make the border controls optional i.e. not displayed by default.

The may indicator of that has been whether the spacing controls were displayed by default. This block doesn't even have spacing support yet. I'd take that as a sign this is very edge case territory and make the controls optional.

Copy link
Member Author

Choose a reason for hiding this comment

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

We could include spacing support also in this PR, and will make border and spacing optional by default. I'll update the PR.

// Return empty if the adjacent post is unavailable.
if ( empty( $content ) ) {
return '';
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure that simply removing the empty element solves all the backward compatibility issues here.

Removing the element and adding CSS may prevent visual regressions for the default situation. There might be use cases out in the wild though where changing the block's markup breaks other theme styles.

We can avoid all BC issues by only applying the styles when needed. I don't think it's a resource-intensive option and saves having to send additional CSS.

@akasunil
Copy link
Member Author

akasunil commented Aug 9, 2024

Does it make sense to add border support without spacing support as well?

I have added spacing support as well, Also made spacing and border support optional.

Also, I have noticed something. Post Navigation Link block works as individual for next and previous link, unlike Query pagination block.

Query pagination block Post navigation block
image image

If we were to apply the styles that we did on query pagination block , We may have to keep it out of post navigation block class. and i don't think we should add css outside block class. Parent of post navigation block could be anything like column, group, grid etc.

@aaronrobertshaw
Copy link
Contributor

Also, I have noticed something. Post Navigation Link block works as individual for next and previous link, unlike Query pagination block.

I might just need more caffeine but I'm not sure I follow your last comment or the issue you're trying to highlight, sorry 😅

The Post Navigation Link block is more equivalent to the Query Pagination Next / Previous blocks rather than the Query Pagination block.

If we were to apply the styles that we did on query pagination block , We may have to keep it out of post navigation block class. and i don't think we should add css outside block class

Those linked styles appear to target the inner Query Pagination Previous and Query Pagination Next blocks rather than the Query Pagination block itself. I still think the styles could be applied to the appropriate Post Navigation Link block via the block's own styles.

That said, I'm also still leaning towards not removing the empty element to avoid BC issues.

@akasunil
Copy link
Member Author

akasunil commented Aug 9, 2024

I might just need more caffeine but I'm not sure I follow your last comment or the issue you're trying to highlight, sorry 😅

Or may be i wasn't clear enough, what I meant to say was that the style we added on query pagination block make sense, as its parent block containing next and previous button as child blocks.

However, post navigation link block can have any parent block like group, grid, column, row etc. So should we concern about the next link is right-justified when the previous link doesn't exist? It seems pointless to render an empty element merely for styling purposes. I know there may be some themes having styles with dependency of empty post navigation link block. But that shouldn't be a barrier to enhancing our functionality.

what do you think ?

@aaronrobertshaw
Copy link
Contributor

what do you think ?

My thoughts haven't changed. We should maintain backward compatibility whenever possible.

It seems pointless to render an empty element merely for styling purposes. I know there may be some themes having styles with dependency of empty post navigation link block. But that shouldn't be a barrier to enhancing our functionality.

At this point, rendering the empty element is not only for styling purposes but also for backward compatibility.

Removing an empty element in favour of additional CSS doesn't provide any change in functionality. It also seems we don't have full history and context as to why this block is the way that it is. Without that understanding that increases the risk in changing it.

I don't see the empty element or additional CSS as perfect solutions. In such a case, I think the pragmatic approach is to err towards the conservative option. The potential removal of the empty element can be communicated, investigated, and discussed with the broader community separately.

@akasunil
Copy link
Member Author

akasunil commented Aug 12, 2024

It also seems we don't have full history and context as to why this block is the way that it is

That worries me too.

I don't see the empty element or additional CSS as perfect solutions. In such a case, I think the pragmatic approach is to err towards the conservative option.

Okay, Got it, I'll skip the serialization of the spacing and border styles and apply the style if a link exists.

@akasunil
Copy link
Member Author

This is how it works now.

post-navigation-link-block-border-spacing-support.webm

Copy link
Contributor

@aaronrobertshaw aaronrobertshaw left a comment

Choose a reason for hiding this comment

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

Thanks for iterating here @akasunil 👍

There is actually a block supports prop that can be set in a block's theme.json called __experimentalSkipSerialization. This prevents a block support feature's classes and styles being added by default to the block's wrapper.

I think there's a benefit, in terms of maintaining the block, if we are consistent in our approach to skipping serialization. What do you think of updating this PR along the lines of other blocks that skip serialization, e.g. the Avatar block?

The linked Avatar block above is probably a straightforward example of skipping serialization, which involves:

  1. Skipping serialization via block.json flag, __experimentalSkipSerialization (which is filterable by extenders)
  2. Leverage the useBorderProps hook in the edit component and apply the resulting classes and styles on the desired element
  3. Collect the border style attributes and use the style engine to produce the classes and inline styles, before applying them where needed.

Does that make sense? I'm happy to elaborate further if needed 🙂

@akasunil
Copy link
Member Author

Thank you @aaronrobertshaw for your detailed feedback. I have updated PR according to your feedback.

Copy link

Flaky tests detected in 8dcec4d.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11053725188
📝 Reported issues:

Copy link
Contributor

@aaronrobertshaw aaronrobertshaw left a comment

Choose a reason for hiding this comment

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

Thanks for your patience here @akasunil!

I've given this another read through and test. There are still a couple of issues with the code.

  1. The block instance styles aren't always present so the PHP changes will result in warning notices being thrown.
  2. The idea of skipping serialization was for the styles to not be applied when the link was empty. This PR still renders block instance styles when the link is empty.
Screenshot 2024-09-27 at 11 55 30 am

Also, the PR description and title doesn't match what's happening e.g. adopting spacing supports as well. Can you please update them?

$wrapper_attributes = get_block_wrapper_attributes(
array(
'class' => $classes,
'style' => $support_styles['style'],
Copy link
Contributor

Choose a reason for hiding this comment

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

This will throw a warning when a block instance doesn't have padding or border styles.

@akasunil akasunil changed the title Post Navigation Link: Add border block support Post Navigation Link: Add border and spacing block support Oct 3, 2024
Copy link
Contributor

@aaronrobertshaw aaronrobertshaw left a comment

Choose a reason for hiding this comment

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

Thanks for your patience here @akasunil 👍

Unfortunately, there are still a couple of issues we need to fix up before this will be ready to merge.

The latest updates help address part of the issue I flagged in my last review but only for borders using custom colors or with different borders per side.

Border block support can apply color classes and these need to be handled as well. I've left some inline comments that expand on this further.

Here's a quick video of what I'm seeing:

Screen.Recording.2024-10-22.at.5.01.54.pm.mov

Comment on lines +187 to +194
<div
{ ...blockProps }
style={ {
...blockProps.style,
...borderProps.style,
...spacingProps.style,
} }
>
Copy link
Contributor

Choose a reason for hiding this comment

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

This only applies styles from the border and spacing props. Border support can define CSS classes to apply as well e.g. has-border-color etc.

You can see this in action in the editor if you apply a border to the Group block. An example that maintains the classes from useBorderProps can be seen in the Avatar block.

One option would be to pass borderProps.className etc in as classes for the useBlockProps call here.

The reason this doesn't present visually in the editor is that the border block support forces inline styles for the colors in the event that a theme doesn't correctly load their color stylesheets in the editor. Even still, we should maintain parity between the frontend and editor for classes wherever possible.

Comment on lines +115 to +116
$support_styles = block_core_post_navigation_link_get_border_and_spacing_attributes( $attributes );
$classes .= ! empty( $support_styles['class'] ) ? " {$support_styles['class']}" : '';
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar to the editor side flagged above, this change doesn't take into account that the border support can apply color CSS classes e.g. has-border-color, has-accent-1-border-color etc for preset colors for "flat" borders.

The result is the issue raised in my last review is still present.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Post Navigation Link Affects the Post Navigation Link Block [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants