@wordpress/block-library 6.0.12 → 6.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/build/group/edit.native.js +1 -1
  2. package/build/group/edit.native.js.map +1 -1
  3. package/build/group/index.js +3 -1
  4. package/build/group/index.js.map +1 -1
  5. package/build/image/image.js +30 -6
  6. package/build/image/image.js.map +1 -1
  7. package/build/navigation/deprecated.js +1 -3
  8. package/build/navigation/deprecated.js.map +1 -1
  9. package/build/navigation/edit/index.js +109 -43
  10. package/build/navigation/edit/index.js.map +1 -1
  11. package/build/navigation/edit/navigation-menu-selector.js +10 -3
  12. package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
  13. package/build/navigation/edit/placeholder/index.js +15 -7
  14. package/build/navigation/edit/placeholder/index.js.map +1 -1
  15. package/build/navigation/edit/responsive-wrapper.js +9 -7
  16. package/build/navigation/edit/responsive-wrapper.js.map +1 -1
  17. package/build/navigation/edit/unsaved-inner-blocks.js +3 -11
  18. package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  19. package/build/navigation/edit/use-navigation-notice.js +54 -0
  20. package/build/navigation/edit/use-navigation-notice.js.map +1 -0
  21. package/build/navigation/index.js +1 -2
  22. package/build/navigation/index.js.map +1 -1
  23. package/build/navigation/menu-items-to-blocks.js +4 -1
  24. package/build/navigation/menu-items-to-blocks.js.map +1 -1
  25. package/build/navigation/use-navigation-menu.js +9 -2
  26. package/build/navigation/use-navigation-menu.js.map +1 -1
  27. package/build/navigation/view.js +14 -9
  28. package/build/navigation/view.js.map +1 -1
  29. package/build/navigation-submenu/edit.js +1 -1
  30. package/build/navigation-submenu/edit.js.map +1 -1
  31. package/build/post-comments/index.js +1 -1
  32. package/build/post-template/edit.js +54 -13
  33. package/build/post-template/edit.js.map +1 -1
  34. package/build/site-logo/edit.js +9 -6
  35. package/build/site-logo/edit.js.map +1 -1
  36. package/build/site-logo/index.js +0 -3
  37. package/build/site-logo/index.js.map +1 -1
  38. package/build/template-part/edit/index.js +7 -1
  39. package/build/template-part/edit/index.js.map +1 -1
  40. package/build-module/group/edit.native.js +1 -1
  41. package/build-module/group/edit.native.js.map +1 -1
  42. package/build-module/group/index.js +3 -1
  43. package/build-module/group/index.js.map +1 -1
  44. package/build-module/image/image.js +31 -7
  45. package/build-module/image/image.js.map +1 -1
  46. package/build-module/navigation/deprecated.js +1 -3
  47. package/build-module/navigation/deprecated.js.map +1 -1
  48. package/build-module/navigation/edit/index.js +107 -44
  49. package/build-module/navigation/edit/index.js.map +1 -1
  50. package/build-module/navigation/edit/navigation-menu-selector.js +9 -3
  51. package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
  52. package/build-module/navigation/edit/placeholder/index.js +15 -7
  53. package/build-module/navigation/edit/placeholder/index.js.map +1 -1
  54. package/build-module/navigation/edit/responsive-wrapper.js +9 -7
  55. package/build-module/navigation/edit/responsive-wrapper.js.map +1 -1
  56. package/build-module/navigation/edit/unsaved-inner-blocks.js +4 -13
  57. package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  58. package/build-module/navigation/edit/use-navigation-notice.js +44 -0
  59. package/build-module/navigation/edit/use-navigation-notice.js.map +1 -0
  60. package/build-module/navigation/index.js +1 -2
  61. package/build-module/navigation/index.js.map +1 -1
  62. package/build-module/navigation/menu-items-to-blocks.js +3 -1
  63. package/build-module/navigation/menu-items-to-blocks.js.map +1 -1
  64. package/build-module/navigation/use-navigation-menu.js +9 -2
  65. package/build-module/navigation/use-navigation-menu.js.map +1 -1
  66. package/build-module/navigation/view.js +14 -9
  67. package/build-module/navigation/view.js.map +1 -1
  68. package/build-module/navigation-submenu/edit.js +1 -1
  69. package/build-module/navigation-submenu/edit.js.map +1 -1
  70. package/build-module/post-comments/index.js +1 -1
  71. package/build-module/post-template/edit.js +54 -15
  72. package/build-module/post-template/edit.js.map +1 -1
  73. package/build-module/site-logo/edit.js +9 -6
  74. package/build-module/site-logo/edit.js.map +1 -1
  75. package/build-module/site-logo/index.js +0 -3
  76. package/build-module/site-logo/index.js.map +1 -1
  77. package/build-module/template-part/edit/index.js +6 -1
  78. package/build-module/template-part/edit/index.js.map +1 -1
  79. package/build-style/common-rtl.css +10 -0
  80. package/build-style/common.css +10 -0
  81. package/build-style/editor-rtl.css +38 -11
  82. package/build-style/editor.css +38 -11
  83. package/build-style/image/editor-rtl.css +16 -0
  84. package/build-style/image/editor.css +16 -0
  85. package/build-style/navigation/editor-rtl.css +11 -0
  86. package/build-style/navigation/editor.css +11 -0
  87. package/build-style/navigation/style-rtl.css +56 -24
  88. package/build-style/navigation/style.css +56 -24
  89. package/build-style/post-comments/style-rtl.css +3 -1
  90. package/build-style/post-comments/style.css +3 -1
  91. package/build-style/post-comments-form/style-rtl.css +2 -2
  92. package/build-style/post-comments-form/style.css +2 -2
  93. package/build-style/site-logo/editor-rtl.css +1 -11
  94. package/build-style/site-logo/editor.css +1 -11
  95. package/build-style/site-logo/style-rtl.css +3 -1
  96. package/build-style/site-logo/style.css +3 -1
  97. package/build-style/style-rtl.css +74 -28
  98. package/build-style/style.css +74 -28
  99. package/package.json +14 -14
  100. package/src/common.scss +12 -0
  101. package/src/editor.scss +12 -0
  102. package/src/gallery/index.php +7 -8
  103. package/src/group/block.json +3 -1
  104. package/src/group/edit.native.js +1 -1
  105. package/src/home-link/index.php +1 -1
  106. package/src/image/editor.scss +18 -0
  107. package/src/image/image.js +32 -8
  108. package/src/image/index.php +1 -1
  109. package/src/navigation/block.json +1 -2
  110. package/src/navigation/deprecated.js +0 -2
  111. package/src/navigation/edit/index.js +166 -60
  112. package/src/navigation/edit/navigation-menu-selector.js +20 -6
  113. package/src/navigation/edit/placeholder/index.js +40 -24
  114. package/src/navigation/edit/responsive-wrapper.js +10 -7
  115. package/src/navigation/edit/unsaved-inner-blocks.js +13 -25
  116. package/src/navigation/edit/use-navigation-notice.js +37 -0
  117. package/src/navigation/editor.scss +14 -0
  118. package/src/navigation/index.php +19 -8
  119. package/src/navigation/menu-items-to-blocks.js +7 -1
  120. package/src/navigation/style.scss +82 -32
  121. package/src/navigation/use-navigation-menu.js +20 -0
  122. package/src/navigation/view.js +15 -9
  123. package/src/navigation-link/index.php +1 -1
  124. package/src/navigation-submenu/edit.js +1 -1
  125. package/src/navigation-submenu/index.php +9 -3
  126. package/src/page-list/index.php +9 -4
  127. package/src/post-comments/block.json +5 -1
  128. package/src/post-comments/index.php +17 -0
  129. package/src/post-comments/style.scss +7 -3
  130. package/src/post-comments-form/index.php +6 -4
  131. package/src/post-comments-form/style.scss +7 -5
  132. package/src/post-template/edit.js +54 -17
  133. package/src/site-logo/block.json +0 -3
  134. package/src/site-logo/edit.js +6 -5
  135. package/src/site-logo/editor.scss +1 -15
  136. package/src/site-logo/index.php +0 -4
  137. package/src/site-logo/style.scss +3 -1
  138. package/src/template-part/edit/index.js +6 -1
  139. package/src/template-part/index.php +5 -2
@@ -452,14 +452,24 @@ function render_block_core_navigation( $attributes, $content, $block ) {
452
452
 
453
453
  }
454
454
 
455
+ $layout_justification = array(
456
+ 'left' => 'items-justified-left',
457
+ 'right' => 'items-justified-right',
458
+ 'center' => 'items-justified-center',
459
+ 'space-between' => 'items-justified-space-between',
460
+ );
461
+
455
462
  // Restore legacy classnames for submenu positioning.
456
463
  $layout_class = '';
457
464
  if ( isset( $attributes['layout']['justifyContent'] ) ) {
458
- if ( 'right' === $attributes['layout']['justifyContent'] ) {
459
- $layout_class .= 'items-justified-right';
460
- } elseif ( 'space-between' === $attributes['layout']['justifyContent'] ) {
461
- $layout_class .= 'items-justified-space-between';
462
- }
465
+ $layout_class .= $layout_justification[ $attributes['layout']['justifyContent'] ];
466
+ }
467
+ if ( isset( $attributes['layout']['orientation'] ) && 'vertical' === $attributes['layout']['orientation'] ) {
468
+ $layout_class .= ' is-vertical';
469
+ }
470
+
471
+ if ( isset( $attributes['layout']['flexWrap'] ) && 'nowrap' === $attributes['layout']['flexWrap'] ) {
472
+ $layout_class .= ' no-wrap';
463
473
  }
464
474
 
465
475
  $colors = block_core_navigation_build_css_colors( $attributes );
@@ -528,10 +538,10 @@ function render_block_core_navigation( $attributes, $content, $block ) {
528
538
  );
529
539
 
530
540
  $responsive_container_markup = sprintf(
531
- '<button aria-expanded="false" aria-haspopup="true" aria-label="%3$s" class="%6$s" data-micromodal-trigger="modal-%1$s"><svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" role="img" aria-hidden="true" focusable="false"><rect x="4" y="7.5" width="16" height="1.5" /><rect x="4" y="15" width="16" height="1.5" /></svg></button>
541
+ '<button aria-haspopup="true" aria-label="%3$s" class="%6$s" data-micromodal-trigger="modal-%1$s"><svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" role="img" aria-hidden="true" focusable="false"><rect x="4" y="7.5" width="16" height="1.5" /><rect x="4" y="15" width="16" height="1.5" /></svg></button>
532
542
  <div class="%5$s" style="%7$s" id="modal-%1$s">
533
543
  <div class="wp-block-navigation__responsive-close" tabindex="-1" data-micromodal-close>
534
- <div class="wp-block-navigation__responsive-dialog" role="dialog" aria-modal="true" aria-labelledby="modal-%1$s-title" >
544
+ <div class="wp-block-navigation__responsive-dialog" aria-label="%8$s">
535
545
  <button aria-label="%4$s" data-micromodal-close class="wp-block-navigation__responsive-container-close"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" role="img" aria-hidden="true" focusable="false"><path d="M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"></path></svg></button>
536
546
  <div class="wp-block-navigation__responsive-container-content" id="modal-%1$s-content">
537
547
  %2$s
@@ -545,7 +555,8 @@ function render_block_core_navigation( $attributes, $content, $block ) {
545
555
  __( 'Close menu' ), // Close button label.
546
556
  implode( ' ', $responsive_container_classes ),
547
557
  implode( ' ', $open_button_classes ),
548
- $colors['overlay_inline_styles']
558
+ $colors['overlay_inline_styles'],
559
+ __( 'Menu' )
549
560
  );
550
561
 
551
562
  return sprintf(
@@ -7,6 +7,7 @@ import { sortBy } from 'lodash';
7
7
  * WordPress dependencies
8
8
  */
9
9
  import { createBlock, parse } from '@wordpress/blocks';
10
+ import { applyFilters } from '@wordpress/hooks';
10
11
 
11
12
  /**
12
13
  * Convert a flat menu item structure to a nested blocks structure.
@@ -21,7 +22,12 @@ export default function menuItemsToBlocks( menuItems ) {
21
22
  }
22
23
 
23
24
  const menuTree = createDataTree( menuItems );
24
- return mapMenuItemsToBlocks( menuTree );
25
+ const blocks = mapMenuItemsToBlocks( menuTree );
26
+ return applyFilters(
27
+ 'blocks.navigation.__unstableMenuItemsToBlocks',
28
+ blocks,
29
+ menuItems
30
+ );
25
31
  }
26
32
 
27
33
  /**
@@ -6,6 +6,10 @@
6
6
  // - .wp-block-navigation-item targets the menu item itself.
7
7
  // - .wp-block-navigation-item__content targets the link inside a menu item.
8
8
  // - .wp-block-navigation__submenu-icon targets the chevron icon indicating submenus.
9
+
10
+ // Size of burger and close icons.
11
+ $navigation-icon-size: 24px;
12
+
9
13
  .wp-block-navigation {
10
14
  position: relative;
11
15
 
@@ -102,6 +106,45 @@
102
106
  height: inherit;
103
107
  }
104
108
  }
109
+
110
+ // Custom properties for layout style cascade: default values.
111
+ --navigation-layout-justification-setting: flex-start;
112
+ --navigation-layout-direction: row;
113
+ --navigation-layout-wrap: wrap;
114
+ --navigation-layout-justify: flex-start;
115
+ --navigation-layout-align: center;
116
+
117
+ &.is-vertical {
118
+ --navigation-layout-direction: column;
119
+ --navigation-layout-justify: initial;
120
+ }
121
+
122
+ &.no-wrap {
123
+ --navigation-layout-wrap: nowrap;
124
+ }
125
+
126
+ &.items-justified-center {
127
+ --navigation-layout-justification-setting: center;
128
+ --navigation-layout-justify: center;
129
+
130
+ &.is-vertical {
131
+ --navigation-layout-align: center;
132
+ }
133
+ }
134
+
135
+ &.items-justified-right {
136
+ --navigation-layout-justification-setting: flex-end;
137
+ --navigation-layout-justify: flex-end;
138
+
139
+ &.is-vertical {
140
+ --navigation-layout-align: flex-end;
141
+ }
142
+ }
143
+
144
+ &.items-justified-space-between {
145
+ --navigation-layout-justification-setting: space-between;
146
+ --navigation-layout-justify: space-between;
147
+ }
105
148
  }
106
149
 
107
150
  // Styles for submenu flyout.
@@ -347,10 +390,10 @@ button.wp-block-navigation-item__content {
347
390
  // Navigation block inner container.
348
391
  .wp-block-navigation__container {
349
392
  display: flex;
350
- flex-wrap: var(--layout-wrap, wrap);
351
- flex-direction: var(--layout-direction, initial);
352
- justify-content: var(--layout-justify, initial);
353
- align-items: var(--layout-align, initial);
393
+ flex-wrap: var(--navigation-layout-wrap, wrap);
394
+ flex-direction: var(--navigation-layout-direction, initial);
395
+ justify-content: var(--navigation-layout-justify, initial);
396
+ align-items: var(--navigation-layout-align, initial);
354
397
 
355
398
  // Reset the default list styles
356
399
  list-style: none;
@@ -384,10 +427,10 @@ button.wp-block-navigation-item__content {
384
427
 
385
428
  .wp-block-navigation__responsive-container-content {
386
429
  display: flex;
387
- flex-wrap: var(--layout-wrap, wrap);
388
- flex-direction: var(--layout-direction, initial);
389
- justify-content: var(--layout-justify, initial);
390
- align-items: var(--layout-align, initial);
430
+ flex-wrap: var(--navigation-layout-wrap, wrap);
431
+ flex-direction: var(--navigation-layout-direction, initial);
432
+ justify-content: var(--navigation-layout-justify, initial);
433
+ align-items: var(--navigation-layout-align, initial);
391
434
  }
392
435
 
393
436
  // If the responsive wrapper is present but overlay is not open,
@@ -405,6 +448,10 @@ button.wp-block-navigation-item__content {
405
448
  &.is-menu-open {
406
449
  display: flex; // Needs to be set to override "none".
407
450
  flex-direction: column;
451
+ background-color: inherit;
452
+
453
+ // Use em units to apply padding, so themes can more easily style this in various ways.
454
+ padding: 2em;
408
455
 
409
456
  // Allow modal to scroll.
410
457
  overflow: auto;
@@ -412,29 +459,30 @@ button.wp-block-navigation-item__content {
412
459
  // Give it a z-index just higher than the adminbar.
413
460
  z-index: 100000;
414
461
 
415
- // Add extra top padding so items don't conflict with close button.
416
- padding: 72px 24px 24px 24px;
417
- background-color: inherit;
418
-
419
462
  .wp-block-navigation__responsive-container-content {
463
+ // Add padding above to accommodate close button.
464
+ padding-top: calc(2em + #{ $navigation-icon-size });
465
+
466
+ // Don't crop the focus style.
467
+ overflow: visible;
468
+
420
469
  // Override the container flex layout settings
421
470
  // because we want overlay menu to always display
422
471
  // as a column.
423
472
  display: flex;
424
473
  flex-direction: column;
474
+ flex-wrap: nowrap;
475
+
425
476
  // Inherit alignment settings from container.
426
- align-items: var(--layout-justification-setting, inherit);
477
+ align-items: var(--navigation-layout-justification-setting, inherit);
427
478
 
428
479
  // Always align the contents of the menu to the top.
429
480
  &,
481
+ .wp-block-page-list,
430
482
  .wp-block-navigation__container {
431
483
  justify-content: flex-start;
432
484
  }
433
485
 
434
- // Allow menu to scroll.
435
- overflow: auto;
436
- padding: 0;
437
-
438
486
  .wp-block-navigation__submenu-icon {
439
487
  display: none;
440
488
  }
@@ -453,20 +501,19 @@ button.wp-block-navigation-item__content {
453
501
  // Position and style.
454
502
  position: static;
455
503
  border: none;
456
- padding-left: 32px;
457
- padding-right: 32px;
504
+ padding-left: 2em;
505
+ padding-right: 2em;
458
506
  }
459
507
 
460
508
  // Space unfolded items using gap and padding for submenus.
461
509
  .wp-block-navigation__submenu-container,
462
510
  .wp-block-navigation__container {
463
511
  gap: var(--wp--style--block-gap, 2em);
512
+ }
464
513
 
465
- // Apply top padding to nested submenus.
466
- .wp-block-navigation__submenu-container,
467
- .wp-block-navigation__container {
468
- padding-top: var(--wp--style--block-gap, 2em);
469
- }
514
+ // Apply top padding to nested submenus.
515
+ .wp-block-navigation__submenu-container {
516
+ padding-top: var(--wp--style--block-gap, 2em);
470
517
  }
471
518
 
472
519
  // A default padding is added to submenu items. It's not appropriate inside the modal.
@@ -481,7 +528,7 @@ button.wp-block-navigation-item__content {
481
528
  display: flex;
482
529
  flex-direction: column;
483
530
  // Inherit alignment settings from container.
484
- align-items: var(--layout-justification-setting, initial);
531
+ align-items: var(--navigation-layout-justification-setting, initial);
485
532
  }
486
533
  }
487
534
 
@@ -547,8 +594,8 @@ button.wp-block-navigation-item__content {
547
594
  fill: currentColor;
548
595
  pointer-events: none;
549
596
  display: block;
550
- width: 24px;
551
- height: 24px;
597
+ width: $navigation-icon-size;
598
+ height: $navigation-icon-size;
552
599
  }
553
600
  }
554
601
 
@@ -566,8 +613,8 @@ button.wp-block-navigation-item__content {
566
613
  // Button to close the menus.
567
614
  .wp-block-navigation__responsive-container-close {
568
615
  position: absolute;
569
- top: 24px;
570
- right: 24px;
616
+ top: 0;
617
+ right: 0;
571
618
  z-index: 2; // Needs to be above the modal z index itself.
572
619
  }
573
620
 
@@ -579,11 +626,14 @@ button.wp-block-navigation-item__content {
579
626
  .is-menu-open .wp-block-navigation__responsive-close,
580
627
  .is-menu-open .wp-block-navigation__responsive-dialog,
581
628
  .is-menu-open .wp-block-navigation__responsive-container-content {
582
- width: 100%;
583
- height: 100%;
629
+ box-sizing: border-box;
584
630
  }
585
631
 
632
+ .wp-block-navigation__responsive-dialog {
633
+ position: relative;
634
+ }
635
+
636
+ // Prevent scrolling of the parent content when the modal is open.
586
637
  html.has-modal-open {
587
638
  overflow: hidden;
588
639
  }
589
-
@@ -12,6 +12,7 @@ export default function useNavigationMenu( ref ) {
12
12
  getEditedEntityRecord,
13
13
  getEntityRecords,
14
14
  hasFinishedResolution,
15
+ canUser,
15
16
  } = select( coreStore );
16
17
 
17
18
  const navigationMenuSingleArgs = [
@@ -64,6 +65,25 @@ export default function useNavigationMenu( ref ) {
64
65
  ),
65
66
  navigationMenu,
66
67
  navigationMenus,
68
+ canUserUpdateNavigationEntity: ref
69
+ ? canUser( 'update', 'navigation', ref )
70
+ : undefined,
71
+ hasResolvedCanUserUpdateNavigationEntity: hasFinishedResolution(
72
+ 'canUser',
73
+ [ 'update', 'navigation', ref ]
74
+ ),
75
+ canUserDeleteNavigationEntity: ref
76
+ ? canUser( 'delete', 'navigation', ref )
77
+ : undefined,
78
+ hasResolvedCanUserDeleteNavigationEntity: hasFinishedResolution(
79
+ 'canUser',
80
+ [ 'delete', 'navigation', ref ]
81
+ ),
82
+ canUserCreateNavigation: canUser( 'create', 'navigation' ),
83
+ hasResolvedCanUserCreateNavigation: hasFinishedResolution(
84
+ 'canUser',
85
+ [ 'create', 'navigation' ]
86
+ ),
67
87
  };
68
88
  },
69
89
  [ ref ]
@@ -5,16 +5,22 @@ import MicroModal from 'micromodal';
5
5
 
6
6
  // Responsive navigation toggle.
7
7
  function navigationToggleModal( modal ) {
8
- const triggerButton = document.querySelector(
9
- `button[data-micromodal-trigger="${ modal.id }"]`
8
+ const dialogContainer = document.querySelector(
9
+ `.wp-block-navigation__responsive-dialog`
10
10
  );
11
- const closeButton = modal.querySelector( 'button[data-micromodal-close]' );
12
- // Use aria-hidden to determine the status of the modal, as this attribute is
13
- // managed by micromodal.
11
+
14
12
  const isHidden = 'true' === modal.getAttribute( 'aria-hidden' );
15
- triggerButton.setAttribute( 'aria-expanded', ! isHidden );
16
- closeButton.setAttribute( 'aria-expanded', ! isHidden );
13
+
17
14
  modal.classList.toggle( 'has-modal-open', ! isHidden );
15
+ dialogContainer.toggleAttribute( 'aria-modal', ! isHidden );
16
+
17
+ if ( isHidden ) {
18
+ dialogContainer.removeAttribute( 'role' );
19
+ dialogContainer.removeAttribute( 'aria-modal' );
20
+ } else {
21
+ dialogContainer.setAttribute( 'role', 'dialog' );
22
+ dialogContainer.setAttribute( 'aria-modal', 'true' );
23
+ }
18
24
 
19
25
  // Add a class to indicate the modal is open.
20
26
  const htmlElement = document.documentElement;
@@ -58,7 +64,7 @@ function toggleSubmenuOnClick( event ) {
58
64
 
59
65
  // Necessary for some themes such as TT1 Blocks, where
60
66
  // scripts could be loaded before the body.
61
- window.onload = () => {
67
+ window.addEventListener( 'load', () => {
62
68
  MicroModal.init( {
63
69
  onShow: navigationToggleModal,
64
70
  onClose: navigationToggleModal,
@@ -95,4 +101,4 @@ window.onload = () => {
95
101
  }
96
102
  } );
97
103
  } );
98
- };
104
+ } );
@@ -98,7 +98,7 @@ function block_core_navigation_link_build_css_font_sizes( $context ) {
98
98
  $font_sizes['css_classes'][] = sprintf( 'has-%s-font-size', $context['fontSize'] );
99
99
  } elseif ( $has_custom_font_size ) {
100
100
  // Add the custom font size inline style.
101
- $font_sizes['inline_styles'] = sprintf( 'font-size: %spx;', $context['style']['typography']['fontSize'] );
101
+ $font_sizes['inline_styles'] = sprintf( 'font-size: %s;', $context['style']['typography']['fontSize'] );
102
102
  }
103
103
 
104
104
  return $font_sizes;
@@ -520,7 +520,7 @@ export default function NavigationSubmenuEdit( {
520
520
  ! selectedBlockHasDescendants ) ||
521
521
  // Show the appender while dragging to allow inserting element between item and the appender.
522
522
  hasDescendants
523
- ? InnerBlocks.DefaultAppender
523
+ ? InnerBlocks.ButtonBlockAppender
524
524
  : false,
525
525
  }
526
526
  );
@@ -98,7 +98,7 @@ function block_core_navigation_submenu_build_css_font_sizes( $context ) {
98
98
  $font_sizes['css_classes'][] = sprintf( 'has-%s-font-size', $context['fontSize'] );
99
99
  } elseif ( $has_custom_font_size ) {
100
100
  // Add the custom font size inline style.
101
- $font_sizes['inline_styles'] = sprintf( 'font-size: %spx;', $context['style']['typography']['fontSize'] );
101
+ $font_sizes['inline_styles'] = sprintf( 'font-size: %s;', $context['style']['typography']['fontSize'] );
102
102
  }
103
103
 
104
104
  return $font_sizes;
@@ -188,6 +188,12 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) {
188
188
  );
189
189
  }
190
190
 
191
+ $aria_label = sprintf(
192
+ /* translators: Accessibility text. %s: Parent page title. */
193
+ __( '%s submenu' ),
194
+ $label
195
+ );
196
+
191
197
  $html = '<li ' . $wrapper_attributes . '>';
192
198
 
193
199
  // If Submenus open on hover, we render an anchor tag with attributes.
@@ -226,11 +232,11 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) {
226
232
  if ( $show_submenu_indicators ) {
227
233
  // The submenu icon is rendered in a button here
228
234
  // so that there's a clickable elment to open the submenu.
229
- $html .= '<button aria-label="' . $label . ' ' . __( 'submenu', 'gutenberg' ) . '" class="wp-block-navigation__submenu-icon wp-block-navigation-submenu__toggle" aria-expanded="false">' . block_core_navigation_submenu_render_submenu_icon() . '</button>';
235
+ $html .= '<button aria-label="' . $aria_label . '" class="wp-block-navigation__submenu-icon wp-block-navigation-submenu__toggle" aria-expanded="false">' . block_core_navigation_submenu_render_submenu_icon() . '</button>';
230
236
  }
231
237
  } else {
232
238
  // If menus open on click, we render the parent as a button.
233
- $html .= '<button aria-label="' . $label . ' ' . __( 'submenu', 'gutenberg' ) . '" class="wp-block-navigation-item__content wp-block-navigation-submenu__toggle" aria-expanded="false">';
239
+ $html .= '<button aria-label="' . $aria_label . '" class="wp-block-navigation-item__content wp-block-navigation-submenu__toggle" aria-expanded="false">';
234
240
 
235
241
  // Wrap title with span to isolate it from submenu icon.
236
242
  $html .= '<span class="wp-block-navigation-item__label">';
@@ -119,7 +119,7 @@ function block_core_page_list_build_css_font_sizes( $context ) {
119
119
  $font_sizes['css_classes'][] = sprintf( 'has-%s-font-size', $context['fontSize'] );
120
120
  } elseif ( $has_custom_font_size ) {
121
121
  // Add the custom font size inline style.
122
- $font_sizes['inline_styles'] = sprintf( 'font-size: %spx;', $context['style']['typography']['fontSize'] );
122
+ $font_sizes['inline_styles'] = sprintf( 'font-size: %s;', $context['style']['typography']['fontSize'] );
123
123
  }
124
124
 
125
125
  return $font_sizes;
@@ -173,12 +173,17 @@ function block_core_page_list_render_nested_page_list( $open_submenus_on_click,
173
173
  }
174
174
  }
175
175
 
176
- $title = wp_kses( $page['title'], wp_kses_allowed_html( 'post' ) );
176
+ $title = wp_kses( $page['title'], wp_kses_allowed_html( 'post' ) );
177
+ $aria_label = sprintf(
178
+ /* translators: Accessibility text. %s: Parent page title. */
179
+ __( '%s submenu' ),
180
+ $title
181
+ );
177
182
 
178
183
  $markup .= '<li class="wp-block-pages-list__item' . $css_class . '"' . $style_attribute . '>';
179
184
 
180
185
  if ( isset( $page['children'] ) && $is_navigation_child && $open_submenus_on_click ) {
181
- $markup .= '<button aria-label="' . $title . ' ' . __( 'submenu', 'gutenberg' ) . '" class="' . $navigation_child_content_class . ' wp-block-navigation-submenu__toggle" aria-expanded="false">' . $title . '<span class="wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon"><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none" role="img" aria-hidden="true" focusable="false"><path d="M1.50002 4L6.00002 8L10.5 4" stroke-width="1.5"></path></svg></span>' .
186
+ $markup .= '<button aria-label="' . $aria_label . '" class="' . $navigation_child_content_class . ' wp-block-navigation-submenu__toggle" aria-expanded="false">' . $title . '<span class="wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon"><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none" role="img" aria-hidden="true" focusable="false"><path d="M1.50002 4L6.00002 8L10.5 4" stroke-width="1.5"></path></svg></span>' .
182
187
  '</button>';
183
188
  } else {
184
189
  $markup .= '<a class="wp-block-pages-list__item__link' . $navigation_child_content_class . '" href="' . esc_url( $page['link'] ) . '"' . $aria_current . '>' . $title . '</a>';
@@ -186,7 +191,7 @@ function block_core_page_list_render_nested_page_list( $open_submenus_on_click,
186
191
 
187
192
  if ( isset( $page['children'] ) ) {
188
193
  if ( $is_navigation_child && $show_submenu_icons && ! $open_submenus_on_click ) {
189
- $markup .= '<button aria-label="' . $title . ' ' . __( 'submenu', 'gutenberg' ) . '" class="wp-block-navigation__submenu-icon wp-block-navigation-submenu__toggle" aria-expanded="false">';
194
+ $markup .= '<button aria-label="' . $aria_label . '" class="wp-block-navigation__submenu-icon wp-block-navigation-submenu__toggle" aria-expanded="false">';
190
195
  $markup .= '<span class="wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon"><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none" role="img" aria-hidden="true" focusable="false"><path d="M1.50002 4L6.00002 8L10.5 4" stroke-width="1.5"></path></svg></span>';
191
196
  $markup .= '</button>';
192
197
  }
@@ -30,5 +30,9 @@
30
30
  "link": true
31
31
  }
32
32
  },
33
- "style": "wp-block-post-comments"
33
+ "style": [
34
+ "wp-block-post-comments",
35
+ "wp-block-buttons",
36
+ "wp-block-button"
37
+ ]
34
38
  }
@@ -66,3 +66,20 @@ function register_block_core_post_comments() {
66
66
  );
67
67
  }
68
68
  add_action( 'init', 'register_block_core_post_comments' );
69
+
70
+ /**
71
+ * Use the button block classes for the form-submit button.
72
+ *
73
+ * @param array $fields The default comment form arguments.
74
+ *
75
+ * @return array Returns the modified fields.
76
+ */
77
+ function post_comments_block_form_defaults( $fields ) {
78
+ if ( wp_is_block_theme() ) {
79
+ $fields['submit_button'] = '<input name="%1$s" type="submit" id="%2$s" class="%3$s wp-block-button__link" value="%4$s" />';
80
+ $fields['submit_field'] = '<p class="form-submit wp-block-button">%1$s %2$s</p>';
81
+ }
82
+
83
+ return $fields;
84
+ }
85
+ add_filter( 'comment_form_defaults', 'post_comments_block_form_defaults' );
@@ -64,9 +64,13 @@
64
64
  }
65
65
  }
66
66
 
67
- .comment-form-comment textarea {
68
- box-sizing: border-box;
69
- width: 100%;
67
+ .comment-form {
68
+ textarea,
69
+ input:not([type="submit"]):not([type="checkbox"]) {
70
+ display: block;
71
+ box-sizing: border-box;
72
+ width: 100%;
73
+ }
70
74
  }
71
75
 
72
76
  .comment-form-cookies-consent {
@@ -54,10 +54,12 @@ add_action( 'init', 'register_block_core_post_comments_form' );
54
54
  *
55
55
  * @return array Returns the modified fields.
56
56
  */
57
- function gutenberg_comment_form_block_form_defaults( $fields ) {
58
- $fields['submit_button'] = '<input name="%1$s" type="submit" id="%2$s" class="%3$s wp-block-button__link" value="%4$s" />';
59
- $fields['submit_field'] = '<p class="form-submit wp-block-button">%1$s %2$s</p>';
57
+ function post_comments_form_block_form_defaults( $fields ) {
58
+ if ( wp_is_block_theme() ) {
59
+ $fields['submit_button'] = '<input name="%1$s" type="submit" id="%2$s" class="%3$s wp-block-button__link" value="%4$s" />';
60
+ $fields['submit_field'] = '<p class="form-submit wp-block-button">%1$s %2$s</p>';
61
+ }
60
62
 
61
63
  return $fields;
62
64
  }
63
- add_filter( 'comment_form_defaults', 'gutenberg_comment_form_block_form_defaults' );
65
+ add_filter( 'comment_form_defaults', 'post_comments_form_block_form_defaults' );
@@ -41,13 +41,15 @@
41
41
  padding: calc(0.667em + 2px); // The extra 2px is added to match outline buttons.
42
42
  }
43
43
 
44
- .comment-form-comment textarea {
45
- display: block;
46
- box-sizing: border-box;
47
- width: 100%;
44
+ .comment-form {
45
+ textarea,
46
+ input:not([type="submit"]):not([type="checkbox"]) {
47
+ display: block;
48
+ box-sizing: border-box;
49
+ width: 100%;
50
+ }
48
51
  }
49
52
 
50
- .comment-form-comment,
51
53
  .comment-form-author,
52
54
  .comment-form-email,
53
55
  .comment-form-url {