@wordpress/block-library 10.0.1-next.v.202606191442.0 → 10.0.1

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 (249) hide show
  1. package/CHANGELOG.md +2 -1
  2. package/build/audio/edit.cjs +8 -1
  3. package/build/audio/edit.cjs.map +2 -2
  4. package/build/breadcrumbs/edit.cjs +0 -1
  5. package/build/breadcrumbs/edit.cjs.map +2 -2
  6. package/build/button/edit.cjs +0 -1
  7. package/build/button/edit.cjs.map +2 -2
  8. package/build/cover/edit/embed-video-url-input.cjs +0 -1
  9. package/build/cover/edit/embed-video-url-input.cjs.map +2 -2
  10. package/build/details/edit.cjs +0 -1
  11. package/build/details/edit.cjs.map +2 -2
  12. package/build/form/edit.cjs +0 -2
  13. package/build/form/edit.cjs.map +2 -2
  14. package/build/form-input/edit.cjs +0 -2
  15. package/build/form-input/edit.cjs.map +2 -2
  16. package/build/freeform/edit.cjs +5 -14
  17. package/build/freeform/edit.cjs.map +3 -3
  18. package/build/freeform/migration-notice.cjs.map +2 -2
  19. package/build/home-link/edit.cjs +0 -1
  20. package/build/home-link/edit.cjs.map +2 -2
  21. package/build/html/modal.cjs +6 -3
  22. package/build/html/modal.cjs.map +2 -2
  23. package/build/icon/edit.cjs +2 -4
  24. package/build/icon/edit.cjs.map +2 -2
  25. package/build/image/image.cjs +0 -2
  26. package/build/image/image.cjs.map +2 -2
  27. package/build/image/use-open-image-media-editor-modal.cjs +5 -25
  28. package/build/image/use-open-image-media-editor-modal.cjs.map +2 -2
  29. package/build/list/ordered-list-settings.cjs +0 -1
  30. package/build/list/ordered-list-settings.cjs.map +2 -2
  31. package/build/navigation/edit/index.cjs +9 -9
  32. package/build/navigation/edit/index.cjs.map +2 -2
  33. package/build/navigation/edit/navigation-menu-name-control.cjs +0 -1
  34. package/build/navigation/edit/navigation-menu-name-control.cjs.map +2 -2
  35. package/build/navigation-link/block.json +1 -1
  36. package/build/navigation-link/link-ui/page-creator.cjs +0 -1
  37. package/build/navigation-link/link-ui/page-creator.cjs.map +2 -2
  38. package/build/navigation-link/shared/controls.cjs +0 -2
  39. package/build/navigation-link/shared/controls.cjs.map +2 -2
  40. package/build/playlist-track/edit.cjs +0 -3
  41. package/build/playlist-track/edit.cjs.map +2 -2
  42. package/build/post-comment/edit.cjs +0 -1
  43. package/build/post-comment/edit.cjs.map +2 -2
  44. package/build/post-featured-image/edit.cjs +0 -1
  45. package/build/post-featured-image/edit.cjs.map +2 -2
  46. package/build/post-terms/edit.cjs +0 -1
  47. package/build/post-terms/edit.cjs.map +2 -2
  48. package/build/post-title/edit.cjs +0 -1
  49. package/build/post-title/edit.cjs.map +2 -2
  50. package/build/query/edit/enhanced-pagination-modal.cjs +10 -1
  51. package/build/query/edit/enhanced-pagination-modal.cjs.map +3 -3
  52. package/build/query/edit/inspector-controls/index.cjs +0 -1
  53. package/build/query/edit/inspector-controls/index.cjs.map +2 -2
  54. package/build/rss/edit.cjs +0 -1
  55. package/build/rss/edit.cjs.map +2 -2
  56. package/build/search/block.json +4 -0
  57. package/build/search/edit.cjs +242 -204
  58. package/build/search/edit.cjs.map +2 -2
  59. package/build/site-logo/edit.cjs +2 -1
  60. package/build/site-logo/edit.cjs.map +2 -2
  61. package/build/social-link/edit.cjs +0 -3
  62. package/build/social-link/edit.cjs.map +2 -2
  63. package/build/tab-list/block.json +2 -2
  64. package/build/tab-list/edit.cjs +14 -8
  65. package/build/tab-list/edit.cjs.map +2 -2
  66. package/build/tab-list/init.cjs +28 -0
  67. package/build/tab-list/init.cjs.map +7 -0
  68. package/build/tab-panel/edit.cjs +0 -9
  69. package/build/tab-panel/edit.cjs.map +2 -2
  70. package/build/tab-panel/save.cjs +2 -1
  71. package/build/tab-panel/save.cjs.map +2 -2
  72. package/build/tab-panels/block.json +0 -1
  73. package/build/tab-panels/init.cjs +28 -0
  74. package/build/tab-panels/init.cjs.map +7 -0
  75. package/build/table/edit.cjs +0 -2
  76. package/build/table/edit.cjs.map +2 -2
  77. package/build/tabs/view.cjs +20 -94
  78. package/build/tabs/view.cjs.map +2 -2
  79. package/build/template-part/edit/advanced-controls.cjs +0 -1
  80. package/build/template-part/edit/advanced-controls.cjs.map +2 -2
  81. package/build/template-part/edit/title-modal.cjs +1 -2
  82. package/build/template-part/edit/title-modal.cjs.map +2 -2
  83. package/build/video/edit.cjs +3 -2
  84. package/build/video/edit.cjs.map +2 -2
  85. package/build/video/tracks-editor.cjs +0 -2
  86. package/build/video/tracks-editor.cjs.map +2 -2
  87. package/build-module/audio/edit.mjs +8 -2
  88. package/build-module/audio/edit.mjs.map +2 -2
  89. package/build-module/breadcrumbs/edit.mjs +0 -1
  90. package/build-module/breadcrumbs/edit.mjs.map +2 -2
  91. package/build-module/button/edit.mjs +0 -1
  92. package/build-module/button/edit.mjs.map +2 -2
  93. package/build-module/cover/edit/embed-video-url-input.mjs +0 -1
  94. package/build-module/cover/edit/embed-video-url-input.mjs.map +2 -2
  95. package/build-module/details/edit.mjs +0 -1
  96. package/build-module/details/edit.mjs.map +2 -2
  97. package/build-module/form/edit.mjs +0 -2
  98. package/build-module/form/edit.mjs.map +2 -2
  99. package/build-module/form-input/edit.mjs +0 -2
  100. package/build-module/form-input/edit.mjs.map +2 -2
  101. package/build-module/freeform/edit.mjs +5 -14
  102. package/build-module/freeform/edit.mjs.map +2 -2
  103. package/build-module/freeform/migration-notice.mjs.map +2 -2
  104. package/build-module/home-link/edit.mjs +0 -1
  105. package/build-module/home-link/edit.mjs.map +2 -2
  106. package/build-module/html/modal.mjs +6 -3
  107. package/build-module/html/modal.mjs.map +2 -2
  108. package/build-module/icon/edit.mjs +2 -4
  109. package/build-module/icon/edit.mjs.map +2 -2
  110. package/build-module/image/image.mjs +0 -2
  111. package/build-module/image/image.mjs.map +2 -2
  112. package/build-module/image/use-open-image-media-editor-modal.mjs +5 -25
  113. package/build-module/image/use-open-image-media-editor-modal.mjs.map +2 -2
  114. package/build-module/list/ordered-list-settings.mjs +0 -1
  115. package/build-module/list/ordered-list-settings.mjs.map +2 -2
  116. package/build-module/navigation/edit/index.mjs +9 -9
  117. package/build-module/navigation/edit/index.mjs.map +2 -2
  118. package/build-module/navigation/edit/navigation-menu-name-control.mjs +0 -1
  119. package/build-module/navigation/edit/navigation-menu-name-control.mjs.map +2 -2
  120. package/build-module/navigation-link/block.json +1 -1
  121. package/build-module/navigation-link/link-ui/page-creator.mjs +0 -1
  122. package/build-module/navigation-link/link-ui/page-creator.mjs.map +2 -2
  123. package/build-module/navigation-link/shared/controls.mjs +0 -2
  124. package/build-module/navigation-link/shared/controls.mjs.map +2 -2
  125. package/build-module/playlist-track/edit.mjs +0 -3
  126. package/build-module/playlist-track/edit.mjs.map +2 -2
  127. package/build-module/post-comment/edit.mjs +0 -1
  128. package/build-module/post-comment/edit.mjs.map +2 -2
  129. package/build-module/post-featured-image/edit.mjs +0 -1
  130. package/build-module/post-featured-image/edit.mjs.map +2 -2
  131. package/build-module/post-terms/edit.mjs +0 -1
  132. package/build-module/post-terms/edit.mjs.map +2 -2
  133. package/build-module/post-title/edit.mjs +0 -1
  134. package/build-module/post-title/edit.mjs.map +2 -2
  135. package/build-module/query/edit/enhanced-pagination-modal.mjs +10 -1
  136. package/build-module/query/edit/enhanced-pagination-modal.mjs.map +2 -2
  137. package/build-module/query/edit/inspector-controls/index.mjs +0 -1
  138. package/build-module/query/edit/inspector-controls/index.mjs.map +2 -2
  139. package/build-module/rss/edit.mjs +0 -1
  140. package/build-module/rss/edit.mjs.map +2 -2
  141. package/build-module/search/block.json +4 -0
  142. package/build-module/search/edit.mjs +242 -204
  143. package/build-module/search/edit.mjs.map +2 -2
  144. package/build-module/site-logo/edit.mjs +2 -1
  145. package/build-module/site-logo/edit.mjs.map +2 -2
  146. package/build-module/social-link/edit.mjs +0 -3
  147. package/build-module/social-link/edit.mjs.map +2 -2
  148. package/build-module/tab-list/block.json +2 -2
  149. package/build-module/tab-list/edit.mjs +15 -9
  150. package/build-module/tab-list/edit.mjs.map +2 -2
  151. package/build-module/tab-list/init.mjs +7 -0
  152. package/build-module/tab-list/init.mjs.map +7 -0
  153. package/build-module/tab-panel/edit.mjs +1 -10
  154. package/build-module/tab-panel/edit.mjs.map +2 -2
  155. package/build-module/tab-panel/save.mjs +2 -1
  156. package/build-module/tab-panel/save.mjs.map +2 -2
  157. package/build-module/tab-panels/block.json +0 -1
  158. package/build-module/tab-panels/init.mjs +7 -0
  159. package/build-module/tab-panels/init.mjs.map +7 -0
  160. package/build-module/table/edit.mjs +0 -2
  161. package/build-module/table/edit.mjs.map +2 -2
  162. package/build-module/tabs/view.mjs +20 -94
  163. package/build-module/tabs/view.mjs.map +2 -2
  164. package/build-module/template-part/edit/advanced-controls.mjs +0 -1
  165. package/build-module/template-part/edit/advanced-controls.mjs.map +2 -2
  166. package/build-module/template-part/edit/title-modal.mjs +1 -2
  167. package/build-module/template-part/edit/title-modal.mjs.map +2 -2
  168. package/build-module/video/edit.mjs +3 -3
  169. package/build-module/video/edit.mjs.map +2 -2
  170. package/build-module/video/tracks-editor.mjs +0 -2
  171. package/build-module/video/tracks-editor.mjs.map +2 -2
  172. package/build-style/editor-rtl.css +0 -15
  173. package/build-style/editor.css +0 -15
  174. package/build-style/style-rtl.css +1 -1
  175. package/build-style/style.css +1 -1
  176. package/build-style/tab-list/style-rtl.css +1 -1
  177. package/build-style/tab-list/style.css +1 -1
  178. package/package.json +40 -40
  179. package/src/audio/edit.js +5 -9
  180. package/src/breadcrumbs/edit.js +0 -1
  181. package/src/button/edit.js +0 -1
  182. package/src/cover/edit/embed-video-url-input.js +0 -1
  183. package/src/cover/test/edit.js +51 -2
  184. package/src/details/edit.js +0 -1
  185. package/src/editor.scss +0 -1
  186. package/src/form/edit.js +0 -2
  187. package/src/form-input/edit.js +0 -2
  188. package/src/freeform/edit.js +6 -29
  189. package/src/freeform/migration-notice.js +2 -4
  190. package/src/home-link/edit.js +0 -1
  191. package/src/html/modal.js +3 -0
  192. package/src/icon/edit.js +0 -2
  193. package/src/image/image.js +0 -2
  194. package/src/image/test/use-open-image-media-editor-modal.js +20 -26
  195. package/src/image/use-open-image-media-editor-modal.js +24 -42
  196. package/src/list/ordered-list-settings.js +0 -1
  197. package/src/navigation/edit/index.js +9 -13
  198. package/src/navigation/edit/navigation-menu-name-control.js +0 -1
  199. package/src/navigation-link/README.md +1 -1
  200. package/src/navigation-link/block.json +1 -1
  201. package/src/navigation-link/link-ui/page-creator.js +0 -1
  202. package/src/navigation-link/shared/controls.js +0 -2
  203. package/src/navigation-link/test/__snapshots__/hooks.js.snap +5 -0
  204. package/src/playlist-track/edit.js +0 -3
  205. package/src/post-comment/edit.js +0 -1
  206. package/src/post-featured-image/edit.js +0 -1
  207. package/src/post-terms/edit.js +0 -1
  208. package/src/post-title/edit.js +0 -1
  209. package/src/query/edit/enhanced-pagination-modal.js +11 -1
  210. package/src/query/edit/inspector-controls/index.js +0 -1
  211. package/src/rss/edit.js +0 -1
  212. package/src/search/README.md +1 -0
  213. package/src/search/block.json +4 -0
  214. package/src/search/edit.js +106 -55
  215. package/src/search/index.php +25 -1
  216. package/src/site-logo/edit.js +3 -1
  217. package/src/social-link/edit.js +0 -3
  218. package/src/tab-list/README.md +1 -1
  219. package/src/tab-list/block.json +2 -2
  220. package/src/tab-list/edit.js +14 -8
  221. package/src/tab-list/index.php +4 -6
  222. package/src/tab-list/init.js +6 -0
  223. package/src/tab-list/style.scss +1 -2
  224. package/src/tab-panel/edit.js +1 -14
  225. package/src/tab-panel/index.php +2 -25
  226. package/src/tab-panel/save.js +1 -0
  227. package/src/tab-panels/block.json +0 -1
  228. package/src/tab-panels/init.js +6 -0
  229. package/src/table/edit.js +0 -2
  230. package/src/tabs/index.php +12 -19
  231. package/src/tabs/view.js +20 -100
  232. package/src/template-part/edit/advanced-controls.js +0 -1
  233. package/src/template-part/edit/title-modal.js +0 -1
  234. package/src/utils/test/style-state.js +26 -26
  235. package/src/video/edit.js +9 -16
  236. package/src/video/tracks-editor.js +0 -2
  237. package/build/freeform/convert-to-blocks-button.cjs +0 -40
  238. package/build/freeform/convert-to-blocks-button.cjs.map +0 -7
  239. package/build/list-item/utils.cjs +0 -57
  240. package/build/list-item/utils.cjs.map +0 -7
  241. package/build-module/freeform/convert-to-blocks-button.mjs +0 -19
  242. package/build-module/freeform/convert-to-blocks-button.mjs.map +0 -7
  243. package/build-module/list-item/utils.mjs +0 -32
  244. package/build-module/list-item/utils.mjs.map +0 -7
  245. package/build-style/tab-list/editor-rtl.css +0 -14
  246. package/build-style/tab-list/editor.css +0 -14
  247. package/src/freeform/convert-to-blocks-button.js +0 -18
  248. package/src/list-item/utils.js +0 -34
  249. package/src/tab-list/editor.scss +0 -17
@@ -35,6 +35,7 @@ import { useInstanceId } from '@wordpress/compose';
35
35
  import { Icon, search } from '@wordpress/icons';
36
36
  import { __, sprintf } from '@wordpress/i18n';
37
37
  import { __unstableStripHTML as stripHTML } from '@wordpress/dom';
38
+ import { speak } from '@wordpress/a11y';
38
39
 
39
40
  /**
40
41
  * Internal dependencies
@@ -47,6 +48,20 @@ import {
47
48
  } from './utils.js';
48
49
  import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
49
50
 
51
+ // Help text describing each wrapper element option. Kept local to the block
52
+ // because the choices and their guidance are specific to the Search block.
53
+ const TAG_NAME_MESSAGES = {
54
+ '': __(
55
+ 'Lets the theme decide. Uses the <search> landmark element if the theme opts in, otherwise a <form>.'
56
+ ),
57
+ search: __(
58
+ 'Wraps the block in a <search> landmark, announced as a search region by assistive technologies.'
59
+ ),
60
+ form: __(
61
+ 'Uses a <form role="search"> wrapper for backward compatibility with existing theme styles.'
62
+ ),
63
+ };
64
+
50
65
  // Used to calculate border radius adjustment to avoid "fat" corners when
51
66
  // button is placed inside wrapper.
52
67
  const DEFAULT_INNER_PADDING = '4px';
@@ -70,6 +85,7 @@ export default function SearchEdit( {
70
85
  buttonText,
71
86
  buttonPosition,
72
87
  buttonUseIcon,
88
+ tagName,
73
89
  style,
74
90
  } = attributes;
75
91
 
@@ -477,6 +493,31 @@ export default function SearchEdit( {
477
493
  </ToolsPanelItem>
478
494
  </ToolsPanel>
479
495
  </InspectorControls>
496
+ <InspectorControls group="advanced">
497
+ <SelectControl
498
+ __next40pxDefaultSize
499
+ label={ __( 'HTML element' ) }
500
+ value={ tagName ?? '' }
501
+ options={ [
502
+ { label: __( 'Default' ), value: '' },
503
+ { label: '<search>', value: 'search' },
504
+ { label: '<form>', value: 'form' },
505
+ ] }
506
+ onChange={ ( value ) => {
507
+ setAttributes( { tagName: value } );
508
+ // The help text is updated via aria-describedby, which
509
+ // is not re-announced while focus remains on the select.
510
+ // Announce the new description so it is not missed.
511
+ // speak() strips HTML-like tags, which would drop the
512
+ // element names (e.g. <search>) entirely. Remove only the
513
+ // angle brackets so the words are retained when spoken.
514
+ speak(
515
+ TAG_NAME_MESSAGES[ value ].replace( /[<>]/g, '' )
516
+ );
517
+ } }
518
+ help={ TAG_NAME_MESSAGES[ tagName ?? '' ] }
519
+ />
520
+ </InspectorControls>
480
521
  </>
481
522
  );
482
523
 
@@ -559,64 +600,74 @@ export default function SearchEdit( {
559
600
  typographyProps.className
560
601
  );
561
602
 
603
+ // Reflect an explicit <search> choice in the editor markup so wrapper
604
+ // styles match the front end. The <form> and theme-deferred default keep
605
+ // the historical <div> to avoid nesting a live <form> in the editor.
606
+ const Wrapper = 'search' === tagName ? 'search' : 'div';
607
+
562
608
  return (
563
- <div { ...blockProps }>
609
+ <>
564
610
  { controls }
565
-
566
- { showLabel && (
567
- <RichText
568
- identifier="label"
569
- className={ labelClassnames }
570
- aria-label={ __( 'Label text' ) }
571
- placeholder={ __( 'Add label…' ) }
572
- withoutInteractiveFormatting
573
- value={ label }
574
- onChange={ ( html ) => setAttributes( { label: html } ) }
575
- style={ typographyProps.style }
576
- />
577
- ) }
578
-
579
- <ResizableBox
580
- size={ {
581
- width:
582
- width === undefined
583
- ? 'auto'
584
- : `${ width }${ widthUnit }`,
585
- height: 'auto',
586
- } }
587
- className={ clsx(
588
- 'wp-block-search__inside-wrapper',
589
- isButtonPositionInside ? borderProps.className : undefined
590
- ) }
591
- style={ getWrapperStyles() }
592
- minWidth={ MIN_WIDTH }
593
- enable={ getResizableSides() }
594
- onResizeStart={ ( event, direction, elt ) => {
595
- setAttributes( {
596
- width: parseInt( elt.offsetWidth, 10 ),
597
- widthUnit: 'px',
598
- } );
599
- toggleSelection( false );
600
- } }
601
- onResizeStop={ ( event, direction, elt, delta ) => {
602
- setAttributes( {
603
- width: parseInt( width + delta.width, 10 ),
604
- } );
605
- toggleSelection( true );
606
- } }
607
- showHandle={ isSelected }
608
- >
609
- { ( isButtonPositionInside ||
610
- isButtonPositionOutside ||
611
- hasOnlyButton ) && (
612
- <>
613
- { renderTextField() }
614
- { renderButton() }
615
- </>
611
+ <Wrapper { ...blockProps }>
612
+ { showLabel && (
613
+ <RichText
614
+ identifier="label"
615
+ className={ labelClassnames }
616
+ aria-label={ __( 'Label text' ) }
617
+ placeholder={ __( 'Add label…' ) }
618
+ withoutInteractiveFormatting
619
+ value={ label }
620
+ onChange={ ( html ) =>
621
+ setAttributes( { label: html } )
622
+ }
623
+ style={ typographyProps.style }
624
+ />
616
625
  ) }
617
626
 
618
- { hasNoButton && renderTextField() }
619
- </ResizableBox>
620
- </div>
627
+ <ResizableBox
628
+ size={ {
629
+ width:
630
+ width === undefined
631
+ ? 'auto'
632
+ : `${ width }${ widthUnit }`,
633
+ height: 'auto',
634
+ } }
635
+ className={ clsx(
636
+ 'wp-block-search__inside-wrapper',
637
+ isButtonPositionInside
638
+ ? borderProps.className
639
+ : undefined
640
+ ) }
641
+ style={ getWrapperStyles() }
642
+ minWidth={ MIN_WIDTH }
643
+ enable={ getResizableSides() }
644
+ onResizeStart={ ( event, direction, elt ) => {
645
+ setAttributes( {
646
+ width: parseInt( elt.offsetWidth, 10 ),
647
+ widthUnit: 'px',
648
+ } );
649
+ toggleSelection( false );
650
+ } }
651
+ onResizeStop={ ( event, direction, elt, delta ) => {
652
+ setAttributes( {
653
+ width: parseInt( width + delta.width, 10 ),
654
+ } );
655
+ toggleSelection( true );
656
+ } }
657
+ showHandle={ isSelected }
658
+ >
659
+ { ( isButtonPositionInside ||
660
+ isButtonPositionOutside ||
661
+ hasOnlyButton ) && (
662
+ <>
663
+ { renderTextField() }
664
+ { renderButton() }
665
+ </>
666
+ ) }
667
+
668
+ { hasNoButton && renderTextField() }
669
+ </ResizableBox>
670
+ </Wrapper>
671
+ </>
621
672
  );
622
673
  }
@@ -191,8 +191,32 @@ function render_block_core_search( $attributes ) {
191
191
  ';
192
192
  }
193
193
 
194
+ /*
195
+ * The semantic <search> landmark wrapper is opt-in to preserve back
196
+ * compatibility with themes targeting <form role="search">. The block
197
+ * exposes a per-instance HTML element selector with three values:
198
+ *
199
+ * - 'search' forces the <search> wrapper
200
+ * - 'form' forces the original <form role="search"> markup
201
+ * - empty defers to the 'search-element' html5 sub-feature
202
+ * ( add_theme_support( 'html5', array( 'search-element' ) ) ),
203
+ * matching the opt-in added to get_search_form() in core
204
+ */
205
+ $tag_name = $attributes['tagName'] ?? '';
206
+ $use_search_element = 'search' === $tag_name || ( '' === $tag_name && current_theme_supports( 'html5', 'search-element' ) );
207
+
208
+ /*
209
+ * Only the wrapper markup differs between the semantic <search> landmark
210
+ * and the classic <form role="search">. Positional specifiers keep a
211
+ * single argument list usable by both formats, since the action URL
212
+ * precedes the wrapper attributes in the <search> variant.
213
+ */
214
+ $format = $use_search_element
215
+ ? '<search %2$s %3$s><form method="get" action="%1$s">%4$s</form></search>'
216
+ : '<form role="search" method="get" action="%1$s" %2$s %3$s>%4$s</form>';
217
+
194
218
  return sprintf(
195
- '<form role="search" method="get" action="%1$s" %2$s %3$s>%4$s</form>',
219
+ $format,
196
220
  esc_url( home_url( '/' ) ),
197
221
  $wrapper_attributes,
198
222
  $form_directives,
@@ -75,7 +75,8 @@ const SiteLogo = ( {
75
75
  const [ { naturalWidth, naturalHeight }, setNaturalSize ] = useState( {} );
76
76
  const [ isEditingImage, setIsEditingImage ] = useState( false );
77
77
  const cropButtonRef = useRef();
78
- const { toggleSelection } = useDispatch( blockEditorStore );
78
+ const { toggleSelection, __unstableMarkNextChangeAsNotPersistent } =
79
+ useDispatch( blockEditorStore );
79
80
  const dropdownMenuProps = useToolsPanelDropdownMenuProps();
80
81
 
81
82
  // Check if we're in contentOnly mode
@@ -108,6 +109,7 @@ const SiteLogo = ( {
108
109
  // fallen out of sync. This can happen if the toggle is saved in the `on` position,
109
110
  // but changes are later made to the site icon in the Customizer.
110
111
  if ( shouldSyncIcon && logoId !== iconId ) {
112
+ __unstableMarkNextChangeAsNotPersistent();
111
113
  setAttributes( { shouldSyncIcon: false } );
112
114
  }
113
115
  }, [] );
@@ -191,7 +191,6 @@ const SocialLinkEdit = ( {
191
191
  ) }
192
192
  renderContent={ () => (
193
193
  <TextControl
194
- __next40pxDefaultSize
195
194
  className="wp-block-social-link__toolbar_content_text"
196
195
  label={ __( 'Text' ) }
197
196
  help={ __(
@@ -224,7 +223,6 @@ const SocialLinkEdit = ( {
224
223
  } }
225
224
  >
226
225
  <TextControl
227
- __next40pxDefaultSize
228
226
  label={ __( 'Text' ) }
229
227
  help={ __(
230
228
  'The text is visible when enabled from the parent Social Icons block.'
@@ -240,7 +238,6 @@ const SocialLinkEdit = ( {
240
238
  </InspectorControls>
241
239
  <InspectorControls group="advanced">
242
240
  <TextControl
243
- __next40pxDefaultSize
244
241
  label={ __( 'Link relation' ) }
245
242
  help={ createInterpolateElement(
246
243
  __(
@@ -36,7 +36,7 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
36
36
  - [`typography`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography):
37
37
  - [`fontSize`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography-fontsize): `true`
38
38
  - [`layout`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#layout):
39
- - [`default`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#layout-default): `{"type":"flex"}`
39
+ - [`default`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#layout-default): `{"type":"flex","flexWrap":"nowrap"}`
40
40
  - [`allowVerticalAlignment`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#layout-allowverticalalignment): `false`
41
41
  - [`allowOrientation`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#layout-alloworientation): `false`
42
42
  - [`allowWrap`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#layout-allowwrap): `false`
@@ -49,7 +49,8 @@
49
49
  },
50
50
  "layout": {
51
51
  "default": {
52
- "type": "flex"
52
+ "type": "flex",
53
+ "flexWrap": "nowrap"
53
54
  },
54
55
  "allowVerticalAlignment": false,
55
56
  "allowOrientation": false,
@@ -75,6 +76,5 @@
75
76
  "padding": ".wp-block-tab-list button"
76
77
  }
77
78
  },
78
- "editorStyle": "wp-block-tab-list-editor",
79
79
  "style": "wp-block-tab-list"
80
80
  }
@@ -16,7 +16,7 @@ import {
16
16
  __experimentalGetSpacingClassesAndStyles as getSpacingClassesAndStyles,
17
17
  } from '@wordpress/block-editor';
18
18
  import { useSelect, useDispatch } from '@wordpress/data';
19
- import { useMemo, useCallback, useEffect, useRef } from '@wordpress/element';
19
+ import { useCallback, useEffect, useRef } from '@wordpress/element';
20
20
 
21
21
  /**
22
22
  * Internal dependencies
@@ -26,7 +26,12 @@ import RemoveTabToolbarControl from '../tab-panel/remove-tab-toolbar-control';
26
26
 
27
27
  const EMPTY_ARRAY = [];
28
28
 
29
- function Edit( { attributes, clientId, context } ) {
29
+ function Edit( {
30
+ attributes,
31
+ clientId,
32
+ context,
33
+ __unstableLayoutClassNames: layoutClassNames,
34
+ } ) {
30
35
  const tabsList = context[ 'core/tabs-list' ] || EMPTY_ARRAY;
31
36
 
32
37
  const colorProps = useColorProps( attributes );
@@ -52,9 +57,7 @@ function Edit( { attributes, clientId, context } ) {
52
57
  [ clientId ]
53
58
  );
54
59
 
55
- const effectiveActiveIndex = useMemo( () => {
56
- return editorActiveTabIndex ?? activeTabIndex;
57
- }, [ editorActiveTabIndex, activeTabIndex ] );
60
+ const effectiveActiveIndex = editorActiveTabIndex ?? activeTabIndex;
58
61
 
59
62
  const { __unstableMarkNextChangeAsNotPersistent, updateBlockAttributes } =
60
63
  useDispatch( blockEditorStore );
@@ -126,6 +129,9 @@ function Edit( { attributes, clientId, context } ) {
126
129
  const blockProps = useBlockProps( {
127
130
  role: 'tablist',
128
131
  ref: menuRef,
132
+ // Applied manually since this block has no inner blocks for the layout
133
+ // support to add its container classes to.
134
+ className: layoutClassNames,
129
135
  } );
130
136
 
131
137
  const buttonClassName = clsx( colorProps.className, borderProps.className );
@@ -147,9 +153,9 @@ function Edit( { attributes, clientId, context } ) {
147
153
  <button
148
154
  key={ tab.clientId || index }
149
155
  type="button"
150
- className={ clsx( buttonClassName, {
151
- 'is-active': isActive,
152
- } ) }
156
+ role="tab"
157
+ aria-selected={ isActive }
158
+ className={ buttonClassName || undefined }
153
159
  style={ buttonStyle }
154
160
  tabIndex={ -1 }
155
161
  onClick={ ( event ) => {
@@ -13,7 +13,7 @@
13
13
  * tab-specific attributes (id, aria-controls, context) and interactivity
14
14
  * directives using data from the tabs-list context.
15
15
  *
16
- * @since 7.0.0
16
+ * @since 7.1.0
17
17
  *
18
18
  * @param array $attributes Block attributes.
19
19
  * @param string $content Block content (rendered buttons from save.js).
@@ -32,14 +32,12 @@ function block_core_tab_list_render_callback( array $attributes, string $content
32
32
  $tab_index = 0;
33
33
 
34
34
  while ( $tag_processor->next_tag( 'button' ) ) {
35
- $tab = $tabs_list[ $tab_index ] ?? null;
35
+ $tab_id = $tabs_list[ $tab_index ] ?? null;
36
36
 
37
- if ( null === $tab ) {
37
+ if ( null === $tab_id ) {
38
38
  break;
39
39
  }
40
40
 
41
- $tab_id = $tab['id'] ?? 'tab-' . $tab_index;
42
-
43
41
  $tag_processor->set_attribute( 'id', 'tab__' . $tab_id );
44
42
  $tag_processor->set_attribute( 'aria-controls', $tab_id );
45
43
  $tag_processor->set_attribute( 'data-wp-on--click', 'actions.handleTabClick' );
@@ -60,7 +58,7 @@ function block_core_tab_list_render_callback( array $attributes, string $content
60
58
  /**
61
59
  * Registers the `core/tab-list` block on the server.
62
60
  *
63
- * @since 7.0.0
61
+ * @since 7.1.0
64
62
  */
65
63
  function register_block_core_tab_list() {
66
64
  register_block_type_from_metadata(
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import { init } from './';
5
+
6
+ export default init();
@@ -27,8 +27,7 @@
27
27
  text-transform: inherit;
28
28
  text-align: inherit;
29
29
 
30
- &[aria-selected="true"]::before,
31
- &.is-active::before {
30
+ &[aria-selected="true"]::before {
32
31
  content: "";
33
32
  position: absolute;
34
33
  border-bottom: 2px solid currentColor;
@@ -8,7 +8,7 @@ import {
8
8
  store as blockEditorStore,
9
9
  } from '@wordpress/block-editor';
10
10
  import { useSelect, useDispatch } from '@wordpress/data';
11
- import { useMemo, useRef, useEffect } from '@wordpress/element';
11
+ import { useMemo, useEffect } from '@wordpress/element';
12
12
 
13
13
  /**
14
14
  * Internal dependencies
@@ -24,25 +24,12 @@ const TEMPLATE = [
24
24
  ],
25
25
  ];
26
26
 
27
- const { cancelAnimationFrame } = window;
28
-
29
27
  export default function Edit( { clientId, context, isSelected } ) {
30
- const focusRef = useRef();
31
-
32
28
  // Consume tab indices from context
33
29
  const activeTabIndex = context[ 'core/tabs-activeTabIndex' ];
34
30
  const editorActiveTabIndex = context[ 'core/tabs-editorActiveTabIndex' ];
35
31
  const effectiveActiveIndex = editorActiveTabIndex ?? activeTabIndex;
36
32
 
37
- // Clean up animation frames on unmount.
38
- useEffect( () => {
39
- return () => {
40
- if ( focusRef.current ) {
41
- cancelAnimationFrame( focusRef.current );
42
- }
43
- };
44
- }, [] );
45
-
46
33
  const { blockIndex, hasInnerBlocksSelected, tabsClientId } = useSelect(
47
34
  ( select ) => {
48
35
  const {
@@ -8,7 +8,7 @@
8
8
  /**
9
9
  * Render callback for core/tab-panel.
10
10
  *
11
- * @since 7.0.0
11
+ * @since 7.1.0
12
12
  *
13
13
  * @param array $attributes Block attributes.
14
14
  * @param string $content Block content.
@@ -41,31 +41,8 @@ function block_core_tab_panel_render( array $attributes, string $content, \WP_Bl
41
41
  $tag_processor->set_attribute( 'id', $tab_id );
42
42
  }
43
43
 
44
- /**
45
- * Add interactivity to the tab element.
46
- */
47
- $tag_processor->set_attribute(
48
- 'data-wp-interactive',
49
- 'core/tabs/private'
50
- );
51
- $tag_processor->set_attribute(
52
- 'data-wp-context',
53
- wp_json_encode(
54
- array(
55
- 'tab' => array(
56
- 'id' => $tab_id,
57
- ),
58
- )
59
- )
60
- );
61
-
62
- /**
63
- * Process accessibility and interactivity attributes.
64
- */
65
- $tag_processor->set_attribute( 'role', 'tabpanel' );
66
44
  $tag_processor->set_attribute( 'aria-labelledby', 'tab__' . $tab_id );
67
45
  $tag_processor->set_attribute( 'data-wp-bind--hidden', '!state.isActiveTab' );
68
- $tag_processor->set_attribute( 'tabindex', 0 );
69
46
 
70
47
  return (string) $tag_processor->get_updated_html();
71
48
  }
@@ -75,7 +52,7 @@ function block_core_tab_panel_render( array $attributes, string $content, \WP_Bl
75
52
  *
76
53
  * @hook init
77
54
  *
78
- * @since 7.0.0
55
+ * @since 7.1.0
79
56
  */
80
57
  function register_block_core_tab_panel() {
81
58
  register_block_type_from_metadata(
@@ -6,6 +6,7 @@ import { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';
6
6
  export default function save() {
7
7
  const blockProps = useBlockProps.save( {
8
8
  role: 'tabpanel',
9
+ tabIndex: 0,
9
10
  } );
10
11
  const innerBlocksProps = useInnerBlocksProps.save( blockProps );
11
12
 
@@ -9,7 +9,6 @@
9
9
  "textdomain": "default",
10
10
  "parent": [ "core/tabs" ],
11
11
  "allowedBlocks": [ "core/tab-panel" ],
12
- "attributes": {},
13
12
  "supports": {
14
13
  "html": false,
15
14
  "visibility": false,
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import { init } from './';
5
+
6
+ export default init();
package/src/table/edit.js CHANGED
@@ -563,7 +563,6 @@ function TableEdit( {
563
563
  onSubmit={ onCreateTable }
564
564
  >
565
565
  <TextControl
566
- __next40pxDefaultSize
567
566
  type="number"
568
567
  label={ __( 'Column count' ) }
569
568
  value={ initialColumnCount }
@@ -572,7 +571,6 @@ function TableEdit( {
572
571
  className="blocks-table__placeholder-input"
573
572
  />
574
573
  <TextControl
575
- __next40pxDefaultSize
576
574
  type="number"
577
575
  label={ __( 'Row count' ) }
578
576
  value={ initialRowCount }
@@ -8,12 +8,12 @@
8
8
  /**
9
9
  * Extract tabs list from tab-panel innerblocks.
10
10
  *
11
- * @since 7.0.0
11
+ * @since 7.1.0
12
12
  *
13
13
  * @param array $innerblocks Parsed inner blocks of tabs block.
14
14
  * @param string $tabs_id Unique ID for the tabs instance, used to generate tab IDs.
15
15
  *
16
- * @return array List of tabs with id, label, index.
16
+ * @return array List of tab IDs.
17
17
  */
18
18
  function block_core_tabs_generate_tabs_list( array $innerblocks = array(), string $tabs_id = '' ): array {
19
19
  $tabs_list = array();
@@ -24,8 +24,7 @@ function block_core_tabs_generate_tabs_list( array $innerblocks = array(), strin
24
24
  $tab_index = 0;
25
25
  foreach ( $inner_block['innerBlocks'] ?? array() as $tab_block ) {
26
26
  if ( 'core/tab-panel' === ( $tab_block['blockName'] ?? '' ) ) {
27
- $attrs = $tab_block['attrs'] ?? array();
28
- $tab_label = $attrs['label'] ?? '';
27
+ $attrs = $tab_block['attrs'] ?? array();
29
28
 
30
29
  $tab_id = ! empty( $attrs['anchor'] )
31
30
  ? $attrs['anchor']
@@ -33,11 +32,7 @@ function block_core_tabs_generate_tabs_list( array $innerblocks = array(), strin
33
32
  ? $tabs_id . '-tab-' . $tab_index
34
33
  : 'tab-' . $tab_index );
35
34
 
36
- $tabs_list[] = array(
37
- 'id' => esc_attr( $tab_id ),
38
- 'label' => $tab_label,
39
- 'index' => $tab_index,
40
- );
35
+ $tabs_list[] = esc_attr( $tab_id );
41
36
  ++$tab_index;
42
37
  }
43
38
  }
@@ -53,7 +48,7 @@ function block_core_tabs_generate_tabs_list( array $innerblocks = array(), strin
53
48
  * It is more performant to do this here, once, rather than in the tabs render and tabs context filters.
54
49
  * In this way core/tabs is both a provider and a consumer of the core/tabs-list context.
55
50
  *
56
- * @since 7.0.0
51
+ * @since 7.1.0
57
52
  *
58
53
  * @param array $context Default block context.
59
54
  * @param array $parsed_block The block being rendered.
@@ -63,8 +58,7 @@ function block_core_tabs_generate_tabs_list( array $innerblocks = array(), strin
63
58
  function block_core_tabs_provide_context( array $context, array $parsed_block ): array {
64
59
  if ( 'core/tabs' === $parsed_block['blockName'] ) {
65
60
  // Generate a unique ID for the tabs instance first, so it can be used
66
- // to derive stable tab IDs. Used for 3rd party extensibility to identify
67
- // the tabs instance.
61
+ // to derive stable tab IDs.
68
62
  $tabs_id = $parsed_block['attrs']['anchor'] ?? wp_unique_id( 'tabs_' );
69
63
  $tabs_list = block_core_tabs_generate_tabs_list( $parsed_block['innerBlocks'] ?? array(), $tabs_id );
70
64
  $context['core/tabs-list'] = $tabs_list;
@@ -78,7 +72,7 @@ add_filter( 'render_block_context', 'block_core_tabs_provide_context', 10, 2 );
78
72
  /**
79
73
  * Render callback for core/tabs.
80
74
  *
81
- * @since 7.0.0
75
+ * @since 7.1.0
82
76
  *
83
77
  * @param array $attributes Block attributes.
84
78
  * @param string $content Block content.
@@ -99,7 +93,7 @@ function block_core_tabs_render_block_callback( array $attributes, string $conte
99
93
  $tag_processor = new WP_HTML_Tag_Processor( $content );
100
94
 
101
95
  $tag_processor->next_tag( array( 'class_name' => 'wp-block-tabs' ) );
102
- $tag_processor->set_attribute( 'data-wp-interactive', 'core/tabs/private' );
96
+ $tag_processor->set_attribute( 'data-wp-interactive', 'core/tabs' );
103
97
 
104
98
  $tag_processor->set_attribute(
105
99
  'data-wp-context',
@@ -116,12 +110,11 @@ function block_core_tabs_render_block_callback( array $attributes, string $conte
116
110
  $output = $tag_processor->get_updated_html();
117
111
 
118
112
  /**
119
- * Builds a client side state for just this tabs instance.
120
- * This allows 3rd party extensibility of tabs while retaining
121
- * client side state management per core/tabs instance, like context.
113
+ * Builds a client side state for just this tabs instance, so each
114
+ * core/tabs block manages its own state, like context.
122
115
  */
123
116
  wp_interactivity_state(
124
- 'core/tabs/private',
117
+ 'core/tabs',
125
118
  array(
126
119
  $tabs_id => $tabs_list,
127
120
  )
@@ -133,7 +126,7 @@ function block_core_tabs_render_block_callback( array $attributes, string $conte
133
126
  /**
134
127
  * Registers the `core/tabs` block on the server.
135
128
  *
136
- * @since 7.0.0
129
+ * @since 7.1.0
137
130
  */
138
131
  function register_block_core_tabs() {
139
132
  register_block_type_from_metadata(