@wordpress/block-editor 11.8.0 → 12.0.0

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 (216) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +15 -3
  3. package/build/components/block-info-slot-fill/index.js +47 -0
  4. package/build/components/block-info-slot-fill/index.js.map +1 -0
  5. package/build/components/block-inspector/index.js +4 -2
  6. package/build/components/block-inspector/index.js.map +1 -1
  7. package/build/components/block-list/block.native.js +3 -4
  8. package/build/components/block-list/block.native.js.map +1 -1
  9. package/build/components/block-toolbar/index.js +2 -1
  10. package/build/components/block-toolbar/index.js.map +1 -1
  11. package/build/components/block-tools/block-contextual-toolbar.js +83 -9
  12. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  13. package/build/components/block-tools/selected-block-popover.js +11 -28
  14. package/build/components/block-tools/selected-block-popover.js.map +1 -1
  15. package/build/components/editor-styles/index.js +4 -3
  16. package/build/components/editor-styles/index.js.map +1 -1
  17. package/build/components/font-sizes/fluid-utils.js +21 -14
  18. package/build/components/font-sizes/fluid-utils.js.map +1 -1
  19. package/build/components/global-styles/border-panel.js +2 -32
  20. package/build/components/global-styles/border-panel.js.map +1 -1
  21. package/build/components/global-styles/color-panel.js +12 -12
  22. package/build/components/global-styles/color-panel.js.map +1 -1
  23. package/build/components/global-styles/color-panel.native.js +174 -0
  24. package/build/components/global-styles/color-panel.native.js.map +1 -0
  25. package/build/components/global-styles/dimensions-panel.js +6 -6
  26. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  27. package/build/components/global-styles/effects-panel.js +1 -1
  28. package/build/components/global-styles/effects-panel.js.map +1 -1
  29. package/build/components/global-styles/filters-panel.js +78 -14
  30. package/build/components/global-styles/filters-panel.js.map +1 -1
  31. package/build/components/global-styles/typography-panel.js +9 -9
  32. package/build/components/global-styles/typography-panel.js.map +1 -1
  33. package/build/components/global-styles/use-global-styles-output.js +87 -77
  34. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  35. package/build/components/index.js +7 -0
  36. package/build/components/index.js.map +1 -1
  37. package/build/components/inserter/block-types-tab.js +12 -7
  38. package/build/components/inserter/block-types-tab.js.map +1 -1
  39. package/build/components/inserter/index.js +2 -1
  40. package/build/components/inserter/index.js.map +1 -1
  41. package/build/components/inspector-controls/groups.js +2 -0
  42. package/build/components/inspector-controls/groups.js.map +1 -1
  43. package/build/components/inspector-controls-tabs/styles-tab.js +2 -0
  44. package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  45. package/build/components/list-view/block-select-button.js +7 -2
  46. package/build/components/list-view/block-select-button.js.map +1 -1
  47. package/build/components/list-view/block.js +12 -21
  48. package/build/components/list-view/block.js.map +1 -1
  49. package/build/components/list-view/drop-indicator.js +37 -10
  50. package/build/components/list-view/drop-indicator.js.map +1 -1
  51. package/build/components/list-view/index.js +10 -4
  52. package/build/components/list-view/index.js.map +1 -1
  53. package/build/components/list-view/leaf.js +2 -1
  54. package/build/components/list-view/leaf.js.map +1 -1
  55. package/build/components/list-view/use-block-selection.js +1 -1
  56. package/build/components/list-view/use-block-selection.js.map +1 -1
  57. package/build/components/media-replace-flow/index.js +5 -5
  58. package/build/components/media-replace-flow/index.js.map +1 -1
  59. package/build/components/navigable-toolbar/index.js +12 -4
  60. package/build/components/navigable-toolbar/index.js.map +1 -1
  61. package/build/components/off-canvas-editor/appender.js +2 -7
  62. package/build/components/off-canvas-editor/appender.js.map +1 -1
  63. package/build/hooks/duotone.js +29 -4
  64. package/build/hooks/duotone.js.map +1 -1
  65. package/build/hooks/utils.js +15 -3
  66. package/build/hooks/utils.js.map +1 -1
  67. package/build/private-apis.js +10 -1
  68. package/build/private-apis.js.map +1 -1
  69. package/build/store/actions.js +7 -0
  70. package/build/store/actions.js.map +1 -1
  71. package/build/utils/object.js +5 -5
  72. package/build/utils/object.js.map +1 -1
  73. package/build/utils/transform-styles/index.js +2 -2
  74. package/build/utils/transform-styles/index.js.map +1 -1
  75. package/build/utils/use-should-contextual-toolbar-show.js +68 -0
  76. package/build/utils/use-should-contextual-toolbar-show.js.map +1 -0
  77. package/build-module/components/block-info-slot-fill/index.js +34 -0
  78. package/build-module/components/block-info-slot-fill/index.js.map +1 -0
  79. package/build-module/components/block-inspector/index.js +3 -2
  80. package/build-module/components/block-inspector/index.js.map +1 -1
  81. package/build-module/components/block-list/block.native.js +3 -4
  82. package/build-module/components/block-list/block.native.js.map +1 -1
  83. package/build-module/components/block-toolbar/index.js +2 -1
  84. package/build-module/components/block-toolbar/index.js.map +1 -1
  85. package/build-module/components/block-tools/block-contextual-toolbar.js +79 -9
  86. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  87. package/build-module/components/block-tools/selected-block-popover.js +10 -27
  88. package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
  89. package/build-module/components/editor-styles/index.js +4 -3
  90. package/build-module/components/editor-styles/index.js.map +1 -1
  91. package/build-module/components/font-sizes/fluid-utils.js +21 -14
  92. package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
  93. package/build-module/components/global-styles/border-panel.js +2 -32
  94. package/build-module/components/global-styles/border-panel.js.map +1 -1
  95. package/build-module/components/global-styles/color-panel.js +13 -13
  96. package/build-module/components/global-styles/color-panel.js.map +1 -1
  97. package/build-module/components/global-styles/color-panel.native.js +150 -0
  98. package/build-module/components/global-styles/color-panel.native.js.map +1 -0
  99. package/build-module/components/global-styles/dimensions-panel.js +7 -7
  100. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  101. package/build-module/components/global-styles/effects-panel.js +2 -2
  102. package/build-module/components/global-styles/effects-panel.js.map +1 -1
  103. package/build-module/components/global-styles/filters-panel.js +78 -16
  104. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  105. package/build-module/components/global-styles/typography-panel.js +10 -10
  106. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  107. package/build-module/components/global-styles/use-global-styles-output.js +87 -77
  108. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  109. package/build-module/components/index.js +1 -1
  110. package/build-module/components/index.js.map +1 -1
  111. package/build-module/components/inserter/block-types-tab.js +12 -6
  112. package/build-module/components/inserter/block-types-tab.js.map +1 -1
  113. package/build-module/components/inserter/index.js +2 -1
  114. package/build-module/components/inserter/index.js.map +1 -1
  115. package/build-module/components/inspector-controls/groups.js +2 -0
  116. package/build-module/components/inspector-controls/groups.js.map +1 -1
  117. package/build-module/components/inspector-controls-tabs/styles-tab.js +2 -0
  118. package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  119. package/build-module/components/list-view/block-select-button.js +7 -2
  120. package/build-module/components/list-view/block-select-button.js.map +1 -1
  121. package/build-module/components/list-view/block.js +14 -22
  122. package/build-module/components/list-view/block.js.map +1 -1
  123. package/build-module/components/list-view/drop-indicator.js +36 -10
  124. package/build-module/components/list-view/drop-indicator.js.map +1 -1
  125. package/build-module/components/list-view/index.js +11 -5
  126. package/build-module/components/list-view/index.js.map +1 -1
  127. package/build-module/components/list-view/leaf.js +2 -1
  128. package/build-module/components/list-view/leaf.js.map +1 -1
  129. package/build-module/components/list-view/use-block-selection.js +1 -1
  130. package/build-module/components/list-view/use-block-selection.js.map +1 -1
  131. package/build-module/components/media-replace-flow/index.js +5 -5
  132. package/build-module/components/media-replace-flow/index.js.map +1 -1
  133. package/build-module/components/navigable-toolbar/index.js +12 -4
  134. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  135. package/build-module/components/off-canvas-editor/appender.js +1 -5
  136. package/build-module/components/off-canvas-editor/appender.js.map +1 -1
  137. package/build-module/hooks/duotone.js +28 -5
  138. package/build-module/hooks/duotone.js.map +1 -1
  139. package/build-module/hooks/utils.js +16 -4
  140. package/build-module/hooks/utils.js.map +1 -1
  141. package/build-module/private-apis.js +7 -1
  142. package/build-module/private-apis.js.map +1 -1
  143. package/build-module/store/actions.js +7 -0
  144. package/build-module/store/actions.js.map +1 -1
  145. package/build-module/utils/object.js +4 -4
  146. package/build-module/utils/object.js.map +1 -1
  147. package/build-module/utils/transform-styles/index.js +2 -2
  148. package/build-module/utils/transform-styles/index.js.map +1 -1
  149. package/build-module/utils/use-should-contextual-toolbar-show.js +56 -0
  150. package/build-module/utils/use-should-contextual-toolbar-show.js.map +1 -0
  151. package/build-style/content-rtl.css +9 -6
  152. package/build-style/content.css +9 -6
  153. package/build-style/style-rtl.css +223 -46
  154. package/build-style/style.css +223 -46
  155. package/package.json +32 -32
  156. package/src/components/block-info-slot-fill/index.js +24 -0
  157. package/src/components/block-inspector/index.js +3 -0
  158. package/src/components/block-list/block.native.js +2 -3
  159. package/src/components/block-list/content.scss +16 -15
  160. package/src/components/block-mobile-toolbar/test/block-actions-menu.native.js +9 -9
  161. package/src/components/block-mover/style.scss +10 -4
  162. package/src/components/block-mover/test/index.native.js +4 -4
  163. package/src/components/block-toolbar/index.js +4 -3
  164. package/src/components/block-toolbar/style.scss +56 -33
  165. package/src/components/block-tools/block-contextual-toolbar.js +94 -11
  166. package/src/components/block-tools/selected-block-popover.js +11 -44
  167. package/src/components/block-tools/style.scss +157 -3
  168. package/src/components/editor-styles/index.js +9 -5
  169. package/src/components/font-sizes/fluid-utils.js +31 -14
  170. package/src/components/font-sizes/test/fluid-utils.js +5 -16
  171. package/src/components/global-styles/border-panel.js +1 -30
  172. package/src/components/global-styles/color-panel.js +13 -13
  173. package/src/components/global-styles/color-panel.native.js +207 -0
  174. package/src/components/global-styles/dimensions-panel.js +17 -7
  175. package/src/components/global-styles/effects-panel.js +2 -2
  176. package/src/components/global-styles/filters-panel.js +90 -17
  177. package/src/components/global-styles/style.scss +2 -1
  178. package/src/components/global-styles/test/typography-utils.js +63 -22
  179. package/src/components/global-styles/test/use-global-styles-output.js +126 -4
  180. package/src/components/global-styles/typography-panel.js +37 -11
  181. package/src/components/global-styles/use-global-styles-output.js +64 -64
  182. package/src/components/index.js +1 -0
  183. package/src/components/inserter/block-types-tab.js +9 -6
  184. package/src/components/inserter/index.js +1 -1
  185. package/src/components/inspector-controls/groups.js +2 -0
  186. package/src/components/inspector-controls-tabs/styles-tab.js +1 -0
  187. package/src/components/list-view/block-select-button.js +6 -1
  188. package/src/components/list-view/block.js +23 -31
  189. package/src/components/list-view/drop-indicator.js +67 -22
  190. package/src/components/list-view/index.js +8 -1
  191. package/src/components/list-view/leaf.js +1 -0
  192. package/src/components/list-view/style.scss +15 -3
  193. package/src/components/list-view/use-block-selection.js +1 -1
  194. package/src/components/media-replace-flow/README.md +3 -2
  195. package/src/components/media-replace-flow/index.js +4 -5
  196. package/src/components/navigable-toolbar/index.js +12 -3
  197. package/src/components/off-canvas-editor/appender.js +1 -4
  198. package/src/components/url-popover/test/__snapshots__/index.js.snap +3 -3
  199. package/src/hooks/duotone.js +46 -25
  200. package/src/hooks/test/anchor.js +113 -0
  201. package/src/hooks/test/color.js +0 -9
  202. package/src/hooks/test/use-typography-props.js +2 -2
  203. package/src/hooks/test/utils.js +20 -101
  204. package/src/hooks/utils.js +20 -3
  205. package/src/private-apis.js +6 -0
  206. package/src/store/actions.js +7 -0
  207. package/src/utils/object.js +4 -4
  208. package/src/utils/test/object.js +21 -21
  209. package/src/utils/transform-styles/index.js +2 -2
  210. package/src/utils/use-should-contextual-toolbar-show.js +75 -0
  211. package/tsconfig.json +1 -0
  212. package/build/hooks/color-panel.native.js +0 -77
  213. package/build/hooks/color-panel.native.js.map +0 -1
  214. package/build-module/hooks/color-panel.native.js +0 -62
  215. package/build-module/hooks/color-panel.native.js.map +0 -1
  216. package/src/hooks/color-panel.native.js +0 -63
@@ -53,7 +53,6 @@ function ListViewBlock( {
53
53
  path,
54
54
  isExpanded,
55
55
  selectedClientIds,
56
- preventAnnouncement,
57
56
  isSyncedBranch,
58
57
  } ) {
59
58
  const cellRef = useRef( null );
@@ -90,6 +89,7 @@ function ListViewBlock( {
90
89
  const { toggleBlockHighlight } = useDispatch( blockEditorStore );
91
90
 
92
91
  const blockInformation = useBlockDisplayInformation( clientId );
92
+ const blockTitle = blockInformation?.title || __( 'Untitled' );
93
93
  const blockName = useSelect(
94
94
  ( select ) => select( blockEditorStore ).getBlockName( clientId ),
95
95
  [ clientId ]
@@ -111,31 +111,27 @@ function ListViewBlock( {
111
111
  level
112
112
  );
113
113
 
114
- let blockAriaLabel = __( 'Link' );
115
- if ( blockInformation ) {
116
- blockAriaLabel = isLocked
117
- ? sprintf(
118
- // translators: %s: The title of the block. This string indicates a link to select the locked block.
119
- __( '%s link (locked)' ),
120
- blockInformation.title
121
- )
122
- : sprintf(
123
- // translators: %s: The title of the block. This string indicates a link to select the block.
124
- __( '%s link' ),
125
- blockInformation.title
126
- );
127
- }
128
-
129
- const settingsAriaLabel = blockInformation
114
+ const blockAriaLabel = isLocked
130
115
  ? sprintf(
131
- // translators: %s: The title of the block.
132
- __( 'Options for %s block' ),
133
- blockInformation.title
116
+ // translators: %s: The title of the block. This string indicates a link to select the locked block.
117
+ __( '%s (locked)' ),
118
+ blockTitle
134
119
  )
135
- : __( 'Options' );
120
+ : blockTitle;
121
+
122
+ const settingsAriaLabel = sprintf(
123
+ // translators: %s: The title of the block.
124
+ __( 'Options for %s' ),
125
+ blockTitle
126
+ );
136
127
 
137
- const { isTreeGridMounted, expand, collapse, BlockSettingsMenu } =
138
- useListViewContext();
128
+ const {
129
+ isTreeGridMounted,
130
+ expand,
131
+ collapse,
132
+ BlockSettingsMenu,
133
+ listViewInstanceId,
134
+ } = useListViewContext();
139
135
 
140
136
  const hasSiblings = siblingBlockCount > 0;
141
137
  const hasRenderedMovers = showBlockMovers && hasSiblings;
@@ -246,21 +242,16 @@ function ListViewBlock( {
246
242
  position={ position }
247
243
  rowCount={ rowCount }
248
244
  path={ path }
249
- id={ `list-view-block-${ clientId }` }
245
+ id={ `list-view-${ listViewInstanceId }-block-${ clientId }` }
250
246
  data-block={ clientId }
251
247
  data-expanded={ canExpand ? isExpanded : undefined }
252
- isExpanded={ canExpand ? isExpanded : undefined }
253
- aria-selected={ !! isSelected || forceSelectionContentLock }
254
248
  ref={ rowRef }
255
249
  >
256
250
  <TreeGridCell
257
251
  className="block-editor-list-view-block__contents-cell"
258
252
  colSpan={ colSpan }
259
253
  ref={ cellRef }
260
- aria-label={ blockAriaLabel }
261
254
  aria-selected={ !! isSelected || forceSelectionContentLock }
262
- aria-expanded={ canExpand ? isExpanded : undefined }
263
- aria-describedby={ descriptionId }
264
255
  >
265
256
  { ( { ref, tabIndex, onFocus } ) => (
266
257
  <div className="block-editor-list-view-block__contents-container">
@@ -277,9 +268,10 @@ function ListViewBlock( {
277
268
  currentlyEditingBlockInCanvas ? 0 : tabIndex
278
269
  }
279
270
  onFocus={ onFocus }
280
- isExpanded={ isExpanded }
271
+ isExpanded={ canExpand ? isExpanded : undefined }
281
272
  selectedClientIds={ selectedClientIds }
282
- preventAnnouncement={ preventAnnouncement }
273
+ ariaLabel={ blockAriaLabel }
274
+ ariaDescribedBy={ descriptionId }
283
275
  />
284
276
  <div
285
277
  className="block-editor-list-view-block-select-button__description"
@@ -2,6 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { Popover } from '@wordpress/components';
5
+ import { getScrollContainer } from '@wordpress/dom';
5
6
  import { useCallback, useMemo } from '@wordpress/element';
6
7
 
7
8
  export default function ListViewDropIndicator( {
@@ -40,33 +41,74 @@ export default function ListViewDropIndicator( {
40
41
  // is undefined, so the indicator will appear after the rootBlockElement.
41
42
  const targetElement = blockElement || rootBlockElement;
42
43
 
43
- const getDropIndicatorIndent = useCallback( () => {
44
- if ( ! rootBlockElement ) {
45
- return 0;
46
- }
44
+ const getDropIndicatorIndent = useCallback(
45
+ ( targetElementRect ) => {
46
+ if ( ! rootBlockElement ) {
47
+ return 0;
48
+ }
49
+
50
+ // Calculate the indent using the block icon of the root block.
51
+ // Using a classname selector here might be flaky and could be
52
+ // improved.
53
+ const rootBlockIconElement = rootBlockElement.querySelector(
54
+ '.block-editor-block-icon'
55
+ );
56
+ const rootBlockIconRect =
57
+ rootBlockIconElement.getBoundingClientRect();
58
+ return rootBlockIconRect.right - targetElementRect.left;
59
+ },
60
+ [ rootBlockElement ]
61
+ );
47
62
 
48
- // Calculate the indent using the block icon of the root block.
49
- // Using a classname selector here might be flaky and could be
50
- // improved.
51
- const targetElementRect = targetElement.getBoundingClientRect();
52
- const rootBlockIconElement = rootBlockElement.querySelector(
53
- '.block-editor-block-icon'
54
- );
55
- const rootBlockIconRect = rootBlockIconElement.getBoundingClientRect();
56
- return rootBlockIconRect.right - targetElementRect.left;
57
- }, [ rootBlockElement, targetElement ] );
63
+ const getDropIndicatorWidth = useCallback(
64
+ ( targetElementRect, indent ) => {
65
+ if ( ! targetElement ) {
66
+ return 0;
67
+ }
68
+
69
+ // Default to assuming that the width of the drop indicator
70
+ // should be the same as the target element.
71
+ let width = targetElement.offsetWidth;
72
+
73
+ // In deeply nested lists, where a scrollbar is present,
74
+ // the width of the drop indicator should be the width of
75
+ // the scroll container, minus the distance from the left
76
+ // edge of the scroll container to the left edge of the
77
+ // target element.
78
+ const scrollContainer = getScrollContainer(
79
+ targetElement,
80
+ 'horizontal'
81
+ );
82
+
83
+ if ( scrollContainer ) {
84
+ const scrollContainerRect =
85
+ scrollContainer.getBoundingClientRect();
86
+
87
+ if ( scrollContainer.clientWidth < width ) {
88
+ width =
89
+ scrollContainer.clientWidth -
90
+ ( targetElementRect.left - scrollContainerRect.left );
91
+ }
92
+ }
93
+
94
+ // Subtract the indent from the final width of the indicator.
95
+ return width - indent;
96
+ },
97
+ [ targetElement ]
98
+ );
58
99
 
59
100
  const style = useMemo( () => {
60
101
  if ( ! targetElement ) {
61
102
  return {};
62
103
  }
63
104
 
64
- const indent = getDropIndicatorIndent();
105
+ const targetElementRect = targetElement.getBoundingClientRect();
106
+ const indent = getDropIndicatorIndent( targetElementRect );
65
107
 
66
108
  return {
67
- width: targetElement.offsetWidth - indent,
109
+ width: getDropIndicatorWidth( targetElementRect, indent ),
68
110
  };
69
- }, [ getDropIndicatorIndent, targetElement ] );
111
+ }, [ getDropIndicatorIndent, getDropIndicatorWidth, targetElement ] );
70
112
 
71
113
  const popoverAnchor = useMemo( () => {
72
114
  const isValidDropPosition =
@@ -81,10 +123,8 @@ export default function ListViewDropIndicator( {
81
123
  ownerDocument: targetElement.ownerDocument,
82
124
  getBoundingClientRect() {
83
125
  const rect = targetElement.getBoundingClientRect();
84
- const indent = getDropIndicatorIndent();
85
-
126
+ const indent = getDropIndicatorIndent( rect );
86
127
  const left = rect.left + indent;
87
- const right = rect.right;
88
128
  let top = 0;
89
129
  let bottom = 0;
90
130
 
@@ -97,13 +137,18 @@ export default function ListViewDropIndicator( {
97
137
  bottom = rect.bottom;
98
138
  }
99
139
 
100
- const width = right - left;
140
+ const width = getDropIndicatorWidth( rect, indent );
101
141
  const height = bottom - top;
102
142
 
103
143
  return new window.DOMRect( left, top, width, height );
104
144
  },
105
145
  };
106
- }, [ targetElement, dropPosition, getDropIndicatorIndent ] );
146
+ }, [
147
+ targetElement,
148
+ dropPosition,
149
+ getDropIndicatorIndent,
150
+ getDropIndicatorWidth,
151
+ ] );
107
152
 
108
153
  if ( ! targetElement ) {
109
154
  return null;
@@ -2,6 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import {
5
+ useInstanceId,
5
6
  useMergeRefs,
6
7
  __experimentalUseFixedWindowList as useFixedWindowList,
7
8
  } from '@wordpress/compose';
@@ -63,6 +64,7 @@ export const BLOCK_LIST_ITEM_HEIGHT = 36;
63
64
  * @param {?boolean} props.showAppender Flag to show or hide the block appender. Defaults to `false`.
64
65
  * @param {?ComponentType} props.blockSettingsMenu Optional more menu substitution. Defaults to the standard `BlockSettingsDropdown` component.
65
66
  * @param {string} props.rootClientId The client id of the root block from which we determine the blocks to show in the list.
67
+ * @param {string} props.description Optional accessible description for the tree grid component.
66
68
  * @param {Ref} ref Forwarded ref
67
69
  */
68
70
  function ListViewComponent(
@@ -74,6 +76,7 @@ function ListViewComponent(
74
76
  showAppender = false,
75
77
  blockSettingsMenu: BlockSettingsMenu = BlockSettingsDropdown,
76
78
  rootClientId,
79
+ description,
77
80
  },
78
81
  ref
79
82
  ) {
@@ -88,6 +91,7 @@ function ListViewComponent(
88
91
  );
89
92
  }
90
93
 
94
+ const instanceId = useInstanceId( ListViewComponent );
91
95
  const { clientIdsTree, draggedClientIds, selectedClientIds } =
92
96
  useListViewClientIds( { blocks, rootClientId } );
93
97
 
@@ -198,14 +202,15 @@ function ListViewComponent(
198
202
  expand,
199
203
  collapse,
200
204
  BlockSettingsMenu,
205
+ listViewInstanceId: instanceId,
201
206
  } ),
202
207
  [
203
- isMounted.current,
204
208
  draggedClientIds,
205
209
  expandedState,
206
210
  expand,
207
211
  collapse,
208
212
  BlockSettingsMenu,
213
+ instanceId,
209
214
  ]
210
215
  );
211
216
 
@@ -229,6 +234,8 @@ function ListViewComponent(
229
234
  onExpandRow={ expandRow }
230
235
  onFocusRow={ focusRow }
231
236
  applicationAriaLabel={ __( 'Block navigation structure' ) }
237
+ // eslint-disable-next-line jsx-a11y/aria-props
238
+ aria-description={ description }
232
239
  >
233
240
  <ListViewContext.Provider value={ contextValue }>
234
241
  <ListViewBranch
@@ -51,6 +51,7 @@ const ListViewLeaf = forwardRef(
51
51
  level={ level }
52
52
  positionInSet={ position }
53
53
  setSize={ rowCount }
54
+ isExpanded={ undefined }
54
55
  { ...props }
55
56
  >
56
57
  { children }
@@ -15,6 +15,18 @@
15
15
  // Use position relative for row animation.
16
16
  position: relative;
17
17
 
18
+ .components-button {
19
+ // When a row is expanded, retain the dark color.
20
+ &[aria-expanded="true"] {
21
+ color: $gray-900;
22
+ }
23
+
24
+ // Ensure that on hover, the admin color is still used.
25
+ &:hover {
26
+ color: var(--wp-admin-theme-color);
27
+ }
28
+ }
29
+
18
30
  // The background has to be applied to the td, not tr, or border-radius won't work.
19
31
  &.is-selected td {
20
32
  background: var(--wp-admin-theme-color);
@@ -93,7 +105,7 @@
93
105
  &.is-branch-selected.is-first-selected td:last-child {
94
106
  border-top-right-radius: $radius-block-ui;
95
107
  }
96
- &[aria-expanded="false"] {
108
+ &[data-expanded="false"] {
97
109
  &.is-branch-selected.is-first-selected td:first-child {
98
110
  border-top-left-radius: $radius-block-ui;
99
111
  }
@@ -380,7 +392,7 @@ $block-navigation-max-indent: 8;
380
392
  }
381
393
 
382
394
  // Point downwards when open.
383
- .block-editor-list-view-leaf[aria-expanded="true"] .block-editor-list-view__expander svg {
395
+ .block-editor-list-view-leaf[data-expanded="true"] .block-editor-list-view__expander svg {
384
396
  visibility: visible;
385
397
  transition: transform 0.2s ease;
386
398
  transform: rotate(90deg);
@@ -388,7 +400,7 @@ $block-navigation-max-indent: 8;
388
400
  }
389
401
 
390
402
  // Point rightwards when closed
391
- .block-editor-list-view-leaf[aria-expanded="false"] .block-editor-list-view__expander svg {
403
+ .block-editor-list-view-leaf[data-expanded="false"] .block-editor-list-view__expander svg {
392
404
  visibility: visible;
393
405
  transform: rotate(0deg);
394
406
  transition: transform 0.2s ease;
@@ -144,7 +144,7 @@ export default function useBlockSelection() {
144
144
  }
145
145
 
146
146
  if ( label ) {
147
- speak( label );
147
+ speak( label, 'assertive' );
148
148
  }
149
149
  },
150
150
  [
@@ -65,10 +65,11 @@ Callback called when an upload error happens and receives an error message as an
65
65
 
66
66
  ### name
67
67
 
68
- The label of the replace button.
68
+ A `string` value will be used as the label of the replace button. It can also accept `Phrasing content` elements(ex. `span`).
69
69
 
70
- - Type: `string`
70
+ - Type: `string|Element`
71
71
  - Required: No
72
+ - Default: `Replace`
72
73
 
73
74
  ### createNotice
74
75
 
@@ -59,6 +59,9 @@ const MediaReplaceFlow = ( {
59
59
  multiple = false,
60
60
  addToGallery,
61
61
  handleUpload = true,
62
+ popoverProps = {
63
+ variant: 'toolbar',
64
+ },
62
65
  } ) => {
63
66
  const mediaUpload = useSelect( ( select ) => {
64
67
  return select( blockEditorStore ).getSettings().mediaUpload;
@@ -136,13 +139,9 @@ const MediaReplaceFlow = ( {
136
139
 
137
140
  const gallery = multiple && onlyAllowsImages();
138
141
 
139
- const POPOVER_PROPS = {
140
- variant: 'toolbar',
141
- };
142
-
143
142
  return (
144
143
  <Dropdown
145
- popoverProps={ POPOVER_PROPS }
144
+ popoverProps={ popoverProps }
146
145
  contentClassName="block-editor-media-replace-flow__options"
147
146
  renderToggle={ ( { isOpen, onToggle } ) => (
148
147
  <ToolbarButton
@@ -93,7 +93,8 @@ function useToolbarFocus(
93
93
  focusOnMount,
94
94
  isAccessibleToolbar,
95
95
  defaultIndex,
96
- onIndexChange
96
+ onIndexChange,
97
+ shouldUseKeyboardFocusShortcut
97
98
  ) {
98
99
  // Make sure we don't use modified versions of this prop.
99
100
  const [ initialFocusOnMount ] = useState( focusOnMount );
@@ -103,8 +104,14 @@ function useToolbarFocus(
103
104
  focusFirstTabbableIn( ref.current );
104
105
  }, [] );
105
106
 
107
+ const focusToolbarViaShortcut = () => {
108
+ if ( shouldUseKeyboardFocusShortcut ) {
109
+ focusToolbar();
110
+ }
111
+ };
112
+
106
113
  // Focus on toolbar when pressing alt+F10 when the toolbar is visible.
107
- useShortcut( 'core/block-editor/focus-toolbar', focusToolbar );
114
+ useShortcut( 'core/block-editor/focus-toolbar', focusToolbarViaShortcut );
108
115
 
109
116
  useEffect( () => {
110
117
  if ( initialFocusOnMount ) {
@@ -147,6 +154,7 @@ function useToolbarFocus(
147
154
  function NavigableToolbar( {
148
155
  children,
149
156
  focusOnMount,
157
+ shouldUseKeyboardFocusShortcut = true,
150
158
  __experimentalInitialIndex: initialIndex,
151
159
  __experimentalOnIndexChange: onIndexChange,
152
160
  ...props
@@ -159,7 +167,8 @@ function NavigableToolbar( {
159
167
  focusOnMount,
160
168
  isAccessibleToolbar,
161
169
  initialIndex,
162
- onIndexChange
170
+ onIndexChange,
171
+ shouldUseKeyboardFocusShortcut
163
172
  );
164
173
 
165
174
  if ( isAccessibleToolbar ) {
@@ -17,9 +17,7 @@ import { __, sprintf } from '@wordpress/i18n';
17
17
  */
18
18
  import { store as blockEditorStore } from '../../store';
19
19
  import useBlockDisplayTitle from '../block-title/use-block-display-title';
20
-
21
- import { unlock } from '../../lock-unlock';
22
- import { privateApis as blockEditorPrivateApis } from '../../private-apis';
20
+ import { ComposedPrivateInserter as PrivateInserter } from '../inserter';
23
21
 
24
22
  const prioritizedInserterBlocks = [
25
23
  'core/navigation-link/page',
@@ -86,7 +84,6 @@ export const Appender = forwardRef(
86
84
  if ( hideInserter ) {
87
85
  return null;
88
86
  }
89
- const { PrivateInserter } = unlock( blockEditorPrivateApis );
90
87
  const descriptionId = `off-canvas-editor-appender__${ instanceId }`;
91
88
  const description = sprintf(
92
89
  /* translators: 1: The name of the block. 2: The numerical position of the block. 3: The level of nesting for the block. */
@@ -5,7 +5,7 @@ exports[`URLPopover matches the snapshot in its default state 1`] = `
5
5
  <span>
6
6
  <div
7
7
  class="components-popover block-editor-url-popover is-positioned"
8
- style="position: absolute; top: 0px; left: 0px; transform: none;"
8
+ style="position: absolute; top: 0px; left: 0px; transform: translateZ(0);"
9
9
  tabindex="-1"
10
10
  >
11
11
  <div
@@ -53,7 +53,7 @@ exports[`URLPopover matches the snapshot when the settings are toggled open 1`]
53
53
  <span>
54
54
  <div
55
55
  class="components-popover block-editor-url-popover is-positioned"
56
- style="position: absolute; top: 0px; left: 0px; transform: none;"
56
+ style="position: absolute; top: 0px; left: 0px; transform: translateZ(0);"
57
57
  tabindex="-1"
58
58
  >
59
59
  <div
@@ -108,7 +108,7 @@ exports[`URLPopover matches the snapshot when there are no settings 1`] = `
108
108
  <span>
109
109
  <div
110
110
  class="components-popover block-editor-url-popover is-positioned"
111
- style="position: absolute; top: 0px; left: 0px; transform: none;"
111
+ style="position: absolute; top: 0px; left: 0px; transform: translateZ(0);"
112
112
  tabindex="-1"
113
113
  >
114
114
  <div
@@ -23,6 +23,7 @@ import { useSelect } from '@wordpress/data';
23
23
  */
24
24
  import {
25
25
  BlockControls,
26
+ InspectorControls,
26
27
  __experimentalDuotoneControl as DuotoneControl,
27
28
  useSetting,
28
29
  } from '../components';
@@ -34,7 +35,9 @@ import {
34
35
  } from '../components/duotone';
35
36
  import { getBlockCSSSelector } from '../components/global-styles/get-block-css-selector';
36
37
  import { scopeSelector } from '../components/global-styles/utils';
38
+ import { useBlockSettings } from './utils';
37
39
  import { store as blockEditorStore } from '../store';
40
+ import { default as StylesFiltersPanel } from '../components/global-styles/filters-panel';
38
41
 
39
42
  const EMPTY_ARRAY = [];
40
43
 
@@ -106,9 +109,10 @@ export function getDuotonePresetFromColors( colors, duotonePalette ) {
106
109
  return preset ? `var:preset|duotone|${ preset.slug }` : undefined;
107
110
  }
108
111
 
109
- function DuotonePanel( { attributes, setAttributes } ) {
112
+ function DuotonePanel( { attributes, setAttributes, name } ) {
110
113
  const style = attributes?.style;
111
114
  const duotoneStyle = style?.color?.duotone;
115
+ const settings = useBlockSettings( name );
112
116
 
113
117
  const duotonePalette = useMultiOriginPresets( {
114
118
  presetSetting: 'color.duotone',
@@ -132,30 +136,47 @@ function DuotonePanel( { attributes, setAttributes } ) {
132
136
  : duotoneStyle;
133
137
 
134
138
  return (
135
- <BlockControls group="block" __experimentalShareWithChildBlocks>
136
- <DuotoneControl
137
- duotonePalette={ duotonePalette }
138
- colorPalette={ colorPalette }
139
- disableCustomDuotone={ disableCustomDuotone }
140
- disableCustomColors={ disableCustomColors }
141
- value={ duotonePresetOrColors }
142
- onChange={ ( newDuotone ) => {
143
- const maybePreset = getDuotonePresetFromColors(
144
- newDuotone,
145
- duotonePalette
146
- );
147
-
148
- const newStyle = {
149
- ...style,
150
- color: {
151
- ...style?.color,
152
- duotone: maybePreset ?? newDuotone, // use preset or fallback to custom colors.
153
- },
154
- };
155
- setAttributes( { style: newStyle } );
156
- } }
157
- />
158
- </BlockControls>
139
+ <>
140
+ <InspectorControls group="filter">
141
+ <StylesFiltersPanel
142
+ value={ { filter: { duotone: duotonePresetOrColors } } }
143
+ onChange={ ( newDuotone ) => {
144
+ const newStyle = {
145
+ color: {
146
+ ...newDuotone?.filter,
147
+ },
148
+ };
149
+ setAttributes( { style: newStyle } );
150
+ } }
151
+ settings={ settings }
152
+ />
153
+ </InspectorControls>
154
+ <BlockControls group="block" __experimentalShareWithChildBlocks>
155
+ <DuotoneControl
156
+ duotonePalette={ duotonePalette }
157
+ colorPalette={ colorPalette }
158
+ disableCustomDuotone={ disableCustomDuotone }
159
+ disableCustomColors={ disableCustomColors }
160
+ value={ duotonePresetOrColors }
161
+ onChange={ ( newDuotone ) => {
162
+ const maybePreset = getDuotonePresetFromColors(
163
+ newDuotone,
164
+ duotonePalette
165
+ );
166
+
167
+ const newStyle = {
168
+ ...style,
169
+ color: {
170
+ ...style?.color,
171
+ duotone: maybePreset ?? newDuotone, // use preset or fallback to custom colors.
172
+ },
173
+ };
174
+ setAttributes( { style: newStyle } );
175
+ } }
176
+ settings={ settings }
177
+ />
178
+ </BlockControls>
179
+ </>
159
180
  );
160
181
  }
161
182