@wordpress/components 23.2.0 → 23.3.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 (377) hide show
  1. package/CHANGELOG.md +35 -1
  2. package/CONTRIBUTING.md +1 -1
  3. package/build/alignment-matrix-control/utils.js +2 -2
  4. package/build/alignment-matrix-control/utils.js.map +1 -1
  5. package/build/autocomplete/autocompleter-ui.js +1 -3
  6. package/build/autocomplete/autocompleter-ui.js.map +1 -1
  7. package/build/border-box-control/border-box-control-linked-button/component.js.map +1 -1
  8. package/build/border-box-control/border-box-control-linked-button/hook.js.map +1 -1
  9. package/build/border-control/border-control-dropdown/component.js +8 -4
  10. package/build/border-control/border-control-dropdown/component.js.map +1 -1
  11. package/build/button/deprecated.js +8 -6
  12. package/build/button/deprecated.js.map +1 -1
  13. package/build/button/index.js +52 -23
  14. package/build/button/index.js.map +1 -1
  15. package/build/button/types.js +6 -0
  16. package/build/button/types.js.map +1 -0
  17. package/build/color-list-picker/index.js.map +1 -1
  18. package/build/color-list-picker/types.js +6 -0
  19. package/build/color-list-picker/types.js.map +1 -0
  20. package/build/color-palette/index.js +9 -61
  21. package/build/color-palette/index.js.map +1 -1
  22. package/build/color-palette/index.native.js +24 -9
  23. package/build/color-palette/index.native.js.map +1 -1
  24. package/build/color-palette/utils.js +103 -0
  25. package/build/color-palette/utils.js.map +1 -0
  26. package/build/custom-gradient-picker/gradient-bar/utils.js +1 -1
  27. package/build/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
  28. package/build/date-time/date/index.js.map +1 -1
  29. package/build/dropdown/index.js +20 -8
  30. package/build/dropdown/index.js.map +1 -1
  31. package/build/form-token-field/token.js +1 -1
  32. package/build/form-token-field/token.js.map +1 -1
  33. package/build/gradient-picker/index.js +9 -1
  34. package/build/gradient-picker/index.js.map +1 -1
  35. package/build/h-stack/component.js +0 -1
  36. package/build/h-stack/component.js.map +1 -1
  37. package/build/input-control/input-field.js +4 -2
  38. package/build/input-control/input-field.js.map +1 -1
  39. package/build/keyboard-shortcuts/index.js +44 -16
  40. package/build/keyboard-shortcuts/index.js.map +1 -1
  41. package/build/keyboard-shortcuts/types.js +6 -0
  42. package/build/keyboard-shortcuts/types.js.map +1 -0
  43. package/build/modal/index.js +1 -1
  44. package/build/modal/index.js.map +1 -1
  45. package/build/notice/index.js +16 -18
  46. package/build/notice/index.js.map +1 -1
  47. package/build/notice/list.js +23 -8
  48. package/build/notice/list.js.map +1 -1
  49. package/build/notice/types.js +6 -0
  50. package/build/notice/types.js.map +1 -0
  51. package/build/number-control/index.js +1 -1
  52. package/build/number-control/index.js.map +1 -1
  53. package/build/query-controls/author-select.js +7 -3
  54. package/build/query-controls/author-select.js.map +1 -1
  55. package/build/query-controls/category-select.js +7 -3
  56. package/build/query-controls/category-select.js.map +1 -1
  57. package/build/query-controls/index.js +68 -20
  58. package/build/query-controls/index.js.map +1 -1
  59. package/build/query-controls/terms.js +4 -3
  60. package/build/query-controls/terms.js.map +1 -1
  61. package/build/query-controls/types.js +6 -0
  62. package/build/query-controls/types.js.map +1 -0
  63. package/build/slot-fill/bubbles-virtually/fill.js +1 -0
  64. package/build/slot-fill/bubbles-virtually/fill.js.map +1 -1
  65. package/build/slot-fill/slot.js +1 -0
  66. package/build/slot-fill/slot.js.map +1 -1
  67. package/build/slot-fill/use-slot.js +1 -11
  68. package/build/slot-fill/use-slot.js.map +1 -1
  69. package/build/snackbar/index.js.map +1 -1
  70. package/build/snackbar/list.js.map +1 -1
  71. package/build/tab-panel/index.js +36 -8
  72. package/build/tab-panel/index.js.map +1 -1
  73. package/build/tree-grid/index.js +1 -1
  74. package/build/tree-grid/index.js.map +1 -1
  75. package/build/tree-select/index.js +2 -6
  76. package/build/tree-select/index.js.map +1 -1
  77. package/build-module/alignment-matrix-control/utils.js +2 -2
  78. package/build-module/alignment-matrix-control/utils.js.map +1 -1
  79. package/build-module/autocomplete/autocompleter-ui.js +1 -2
  80. package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
  81. package/build-module/border-box-control/border-box-control-linked-button/component.js.map +1 -1
  82. package/build-module/border-box-control/border-box-control-linked-button/hook.js.map +1 -1
  83. package/build-module/border-control/border-control-dropdown/component.js +7 -4
  84. package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
  85. package/build-module/button/deprecated.js +8 -5
  86. package/build-module/button/deprecated.js.map +1 -1
  87. package/build-module/button/index.js +51 -22
  88. package/build-module/button/index.js.map +1 -1
  89. package/build-module/button/types.js +2 -0
  90. package/build-module/button/types.js.map +1 -0
  91. package/build-module/color-list-picker/index.js.map +1 -1
  92. package/build-module/color-list-picker/types.js +2 -0
  93. package/build-module/color-list-picker/types.js.map +1 -0
  94. package/build-module/color-palette/index.js +7 -54
  95. package/build-module/color-palette/index.js.map +1 -1
  96. package/build-module/color-palette/index.native.js +24 -8
  97. package/build-module/color-palette/index.native.js.map +1 -1
  98. package/build-module/color-palette/utils.js +79 -0
  99. package/build-module/color-palette/utils.js.map +1 -0
  100. package/build-module/custom-gradient-picker/gradient-bar/utils.js +1 -1
  101. package/build-module/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
  102. package/build-module/date-time/date/index.js +1 -1
  103. package/build-module/date-time/date/index.js.map +1 -1
  104. package/build-module/dropdown/index.js +19 -8
  105. package/build-module/dropdown/index.js.map +1 -1
  106. package/build-module/form-token-field/token.js +1 -1
  107. package/build-module/form-token-field/token.js.map +1 -1
  108. package/build-module/gradient-picker/index.js +9 -2
  109. package/build-module/gradient-picker/index.js.map +1 -1
  110. package/build-module/h-stack/component.js +0 -1
  111. package/build-module/h-stack/component.js.map +1 -1
  112. package/build-module/input-control/input-field.js +4 -2
  113. package/build-module/input-control/input-field.js.map +1 -1
  114. package/build-module/keyboard-shortcuts/index.js +48 -16
  115. package/build-module/keyboard-shortcuts/index.js.map +1 -1
  116. package/build-module/keyboard-shortcuts/types.js +2 -0
  117. package/build-module/keyboard-shortcuts/types.js.map +1 -0
  118. package/build-module/modal/index.js +1 -1
  119. package/build-module/modal/index.js.map +1 -1
  120. package/build-module/notice/index.js +14 -15
  121. package/build-module/notice/index.js.map +1 -1
  122. package/build-module/notice/list.js +23 -8
  123. package/build-module/notice/list.js.map +1 -1
  124. package/build-module/notice/types.js +2 -0
  125. package/build-module/notice/types.js.map +1 -0
  126. package/build-module/number-control/index.js +1 -1
  127. package/build-module/number-control/index.js.map +1 -1
  128. package/build-module/query-controls/author-select.js +7 -3
  129. package/build-module/query-controls/author-select.js.map +1 -1
  130. package/build-module/query-controls/category-select.js +8 -4
  131. package/build-module/query-controls/category-select.js.map +1 -1
  132. package/build-module/query-controls/index.js +64 -20
  133. package/build-module/query-controls/index.js.map +1 -1
  134. package/build-module/query-controls/terms.js +8 -4
  135. package/build-module/query-controls/terms.js.map +1 -1
  136. package/build-module/query-controls/types.js +2 -0
  137. package/build-module/query-controls/types.js.map +1 -0
  138. package/build-module/slot-fill/bubbles-virtually/fill.js +1 -0
  139. package/build-module/slot-fill/bubbles-virtually/fill.js.map +1 -1
  140. package/build-module/slot-fill/slot.js +1 -0
  141. package/build-module/slot-fill/slot.js.map +1 -1
  142. package/build-module/slot-fill/use-slot.js +2 -12
  143. package/build-module/slot-fill/use-slot.js.map +1 -1
  144. package/build-module/snackbar/index.js.map +1 -1
  145. package/build-module/snackbar/list.js.map +1 -1
  146. package/build-module/tab-panel/index.js +36 -8
  147. package/build-module/tab-panel/index.js.map +1 -1
  148. package/build-module/tree-grid/index.js +1 -1
  149. package/build-module/tree-grid/index.js.map +1 -1
  150. package/build-module/tree-select/index.js +2 -6
  151. package/build-module/tree-select/index.js.map +1 -1
  152. package/build-style/style-rtl.css +5 -0
  153. package/build-style/style.css +5 -0
  154. package/build-types/border-box-control/border-box-control/hook.d.ts +1 -1
  155. package/build-types/border-box-control/border-box-control-linked-button/component.d.ts +1 -1
  156. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +171 -160
  157. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts.map +1 -1
  158. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +1 -1
  159. package/build-types/border-control/border-control/hook.d.ts +1 -1
  160. package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
  161. package/build-types/border-control/border-control-dropdown/hook.d.ts +1 -1
  162. package/build-types/button/deprecated.d.ts +143 -7
  163. package/build-types/button/deprecated.d.ts.map +1 -1
  164. package/build-types/button/index.d.ts +20 -3
  165. package/build-types/button/index.d.ts.map +1 -1
  166. package/build-types/button/stories/index.d.ts +20 -0
  167. package/build-types/button/stories/index.d.ts.map +1 -0
  168. package/build-types/button/test/index.d.ts +2 -0
  169. package/build-types/button/test/index.d.ts.map +1 -0
  170. package/build-types/button/types.d.ts +134 -0
  171. package/build-types/button/types.d.ts.map +1 -0
  172. package/build-types/color-list-picker/index.d.ts +5 -0
  173. package/build-types/color-list-picker/index.d.ts.map +1 -0
  174. package/build-types/color-list-picker/types.d.ts +42 -0
  175. package/build-types/color-list-picker/types.d.ts.map +1 -0
  176. package/build-types/color-palette/index.d.ts +2 -4
  177. package/build-types/color-palette/index.d.ts.map +1 -1
  178. package/build-types/color-palette/stories/index.d.ts +2 -2
  179. package/build-types/color-palette/styles.d.ts +1 -1
  180. package/build-types/color-palette/types.d.ts +1 -1
  181. package/build-types/color-palette/types.d.ts.map +1 -1
  182. package/build-types/color-palette/utils.d.ts +14 -0
  183. package/build-types/color-palette/utils.d.ts.map +1 -0
  184. package/build-types/color-picker/styles.d.ts +2 -2
  185. package/build-types/date-time/date/index.d.ts.map +1 -1
  186. package/build-types/date-time/date/styles.d.ts +3 -3
  187. package/build-types/dropdown/index.d.ts +4 -4
  188. package/build-types/dropdown/index.d.ts.map +1 -1
  189. package/build-types/dropdown/stories/index.d.ts.map +1 -1
  190. package/build-types/dropdown/types.d.ts +9 -10
  191. package/build-types/dropdown/types.d.ts.map +1 -1
  192. package/build-types/font-size-picker/styles.d.ts +2 -2
  193. package/build-types/h-stack/component.d.ts +0 -1
  194. package/build-types/h-stack/component.d.ts.map +1 -1
  195. package/build-types/input-control/input-field.d.ts.map +1 -1
  196. package/build-types/keyboard-shortcuts/index.d.ts +38 -0
  197. package/build-types/keyboard-shortcuts/index.d.ts.map +1 -0
  198. package/build-types/keyboard-shortcuts/stories/index.d.ts +12 -0
  199. package/build-types/keyboard-shortcuts/stories/index.d.ts.map +1 -0
  200. package/build-types/keyboard-shortcuts/test/index.d.ts +2 -0
  201. package/build-types/keyboard-shortcuts/test/index.d.ts.map +1 -0
  202. package/build-types/keyboard-shortcuts/types.d.ts +48 -0
  203. package/build-types/keyboard-shortcuts/types.d.ts.map +1 -0
  204. package/build-types/modal/index.d.ts.map +1 -1
  205. package/build-types/navigator/navigator-back-button/component.d.ts +1 -1
  206. package/build-types/navigator/navigator-back-button/hook.d.ts +2 -2
  207. package/build-types/navigator/navigator-button/component.d.ts +1 -1
  208. package/build-types/navigator/navigator-button/hook.d.ts +2 -2
  209. package/build-types/notice/index.d.ts +16 -0
  210. package/build-types/notice/index.d.ts.map +1 -0
  211. package/build-types/notice/list.d.ts +32 -0
  212. package/build-types/notice/list.d.ts.map +1 -0
  213. package/build-types/notice/stories/index.d.ts +17 -0
  214. package/build-types/notice/stories/index.d.ts.map +1 -0
  215. package/build-types/notice/test/index.d.ts +2 -0
  216. package/build-types/notice/test/index.d.ts.map +1 -0
  217. package/build-types/notice/test/list.d.ts +2 -0
  218. package/build-types/notice/test/list.d.ts.map +1 -0
  219. package/build-types/notice/types.d.ts +128 -0
  220. package/build-types/notice/types.d.ts.map +1 -0
  221. package/build-types/number-control/styles/number-control-styles.d.ts +2 -2
  222. package/build-types/number-control/styles/number-control-styles.d.ts.map +1 -1
  223. package/build-types/placeholder/stories/index.d.ts.map +1 -1
  224. package/build-types/query-controls/author-select.d.ts +4 -0
  225. package/build-types/query-controls/author-select.d.ts.map +1 -0
  226. package/build-types/query-controls/category-select.d.ts +4 -0
  227. package/build-types/query-controls/category-select.d.ts.map +1 -0
  228. package/build-types/query-controls/index.d.ts +30 -0
  229. package/build-types/query-controls/index.d.ts.map +1 -0
  230. package/build-types/query-controls/stories/index.d.ts +13 -0
  231. package/build-types/query-controls/stories/index.d.ts.map +1 -0
  232. package/build-types/query-controls/terms.d.ts +13 -0
  233. package/build-types/query-controls/terms.d.ts.map +1 -0
  234. package/build-types/query-controls/test/terms.d.ts +2 -0
  235. package/build-types/query-controls/test/terms.d.ts.map +1 -0
  236. package/build-types/query-controls/types.d.ts +131 -0
  237. package/build-types/query-controls/types.d.ts.map +1 -0
  238. package/build-types/range-control/index.d.ts +1 -1
  239. package/build-types/slot-fill/bubbles-virtually/fill.d.ts.map +1 -1
  240. package/build-types/slot-fill/use-slot.d.ts.map +1 -1
  241. package/build-types/snackbar/index.d.ts +9 -2
  242. package/build-types/snackbar/index.d.ts.map +1 -1
  243. package/build-types/snackbar/list.d.ts.map +1 -1
  244. package/build-types/snackbar/types.d.ts +15 -88
  245. package/build-types/snackbar/types.d.ts.map +1 -1
  246. package/build-types/tab-panel/index.d.ts.map +1 -1
  247. package/build-types/tab-panel/types.d.ts +1 -1
  248. package/build-types/tab-panel/types.d.ts.map +1 -1
  249. package/build-types/toggle-group-control/stories/index.d.ts.map +1 -1
  250. package/build-types/tree-select/index.d.ts.map +1 -1
  251. package/build-types/ui/form-group/form-group.d.ts +2 -2
  252. package/package.json +18 -17
  253. package/src/alignment-matrix-control/utils.tsx +2 -2
  254. package/src/autocomplete/autocompleter-ui.js +1 -2
  255. package/src/autocomplete/test/index.js +1 -5
  256. package/src/border-box-control/border-box-control-linked-button/component.tsx +1 -1
  257. package/src/border-box-control/border-box-control-linked-button/hook.ts +1 -1
  258. package/src/border-control/border-control-dropdown/component.tsx +9 -8
  259. package/src/box-control/test/index.js +11 -35
  260. package/src/button/README.md +49 -55
  261. package/src/button/{deprecated.js → deprecated.tsx} +19 -4
  262. package/src/button/{index.js → index.tsx} +95 -34
  263. package/src/button/stories/index.tsx +106 -0
  264. package/src/button/style.scss +3 -2
  265. package/src/button/test/{index.js → index.tsx} +30 -7
  266. package/src/button/types.ts +138 -0
  267. package/src/checkbox-control/test/index.tsx +1 -5
  268. package/src/color-list-picker/{index.js → index.tsx} +3 -2
  269. package/src/color-list-picker/types.ts +46 -0
  270. package/src/color-palette/README.md +1 -1
  271. package/src/color-palette/index.native.js +11 -4
  272. package/src/color-palette/index.tsx +11 -67
  273. package/src/color-palette/test/index.tsx +4 -14
  274. package/src/color-palette/test/utils.ts +1 -1
  275. package/src/color-palette/types.ts +1 -1
  276. package/src/color-palette/utils.ts +98 -0
  277. package/src/color-picker/test/index.js +6 -15
  278. package/src/combobox-control/test/index.js +1 -6
  279. package/src/confirm-dialog/test/index.js +9 -29
  280. package/src/custom-gradient-picker/gradient-bar/utils.js +1 -1
  281. package/src/date-time/date/index.tsx +2 -1
  282. package/src/date-time/date/test/index.tsx +2 -8
  283. package/src/date-time/time/test/index.tsx +9 -29
  284. package/src/dimension-control/test/index.test.js +2 -8
  285. package/src/disabled/test/index.tsx +1 -5
  286. package/src/draggable/test/index.native.js +4 -4
  287. package/src/dropdown/README.md +1 -8
  288. package/src/dropdown/index.tsx +17 -6
  289. package/src/dropdown/stories/index.tsx +3 -3
  290. package/src/dropdown/test/index.tsx +2 -8
  291. package/src/dropdown/types.ts +9 -10
  292. package/src/dropdown-menu/README.md +1 -1
  293. package/src/dropdown-menu/stories/index.js +96 -27
  294. package/src/dropdown-menu/test/index.js +2 -8
  295. package/src/external-link/test/index.tsx +1 -6
  296. package/src/focal-point-picker/test/index.js +3 -11
  297. package/src/font-size-picker/test/index.tsx +14 -44
  298. package/src/form-file-upload/test/index.tsx +2 -17
  299. package/src/form-toggle/test/index.tsx +1 -5
  300. package/src/form-token-field/test/index.tsx +80 -163
  301. package/src/form-token-field/token.tsx +1 -1
  302. package/src/gradient-picker/index.js +15 -4
  303. package/src/guide/test/index.js +5 -17
  304. package/src/h-stack/component.tsx +0 -1
  305. package/src/higher-order/with-filters/test/index.js +24 -24
  306. package/src/higher-order/with-focus-outside/test/index.js +11 -25
  307. package/src/higher-order/with-focus-return/test/index.js +1 -5
  308. package/src/input-control/input-field.tsx +3 -1
  309. package/src/input-control/test/index.js +1 -6
  310. package/src/isolated-event-container/test/index.js +2 -8
  311. package/src/keyboard-shortcuts/README.md +1 -1
  312. package/src/keyboard-shortcuts/index.tsx +93 -0
  313. package/src/keyboard-shortcuts/stories/index.tsx +60 -0
  314. package/src/keyboard-shortcuts/test/{index.js → index.tsx} +16 -6
  315. package/src/keyboard-shortcuts/types.ts +51 -0
  316. package/src/modal/index.tsx +1 -2
  317. package/src/navigable-container/test/navigable-menu.js +5 -17
  318. package/src/navigable-container/test/tababble-container.js +3 -11
  319. package/src/navigation/test/index.js +3 -11
  320. package/src/navigator/test/index.tsx +6 -20
  321. package/src/notice/README.md +89 -42
  322. package/src/notice/{index.js → index.tsx} +28 -20
  323. package/src/notice/list.tsx +72 -0
  324. package/src/notice/stories/index.tsx +119 -0
  325. package/src/notice/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
  326. package/src/notice/test/{index.js → index.tsx} +7 -4
  327. package/src/notice/test/{list.js → list.tsx} +0 -0
  328. package/src/notice/types.ts +136 -0
  329. package/src/number-control/index.tsx +1 -1
  330. package/src/number-control/test/index.tsx +28 -86
  331. package/src/panel/test/body.js +2 -8
  332. package/src/placeholder/stories/index.tsx +1 -0
  333. package/src/query-controls/README.md +56 -56
  334. package/src/query-controls/author-select.tsx +37 -0
  335. package/src/query-controls/category-select.tsx +46 -0
  336. package/src/query-controls/index.tsx +192 -0
  337. package/src/query-controls/stories/index.tsx +205 -0
  338. package/src/query-controls/terms.ts +57 -0
  339. package/src/query-controls/test/{terms.js → terms.ts} +36 -20
  340. package/src/query-controls/types.ts +150 -0
  341. package/src/select-control/test/select-control.tsx +1 -6
  342. package/src/slot-fill/bubbles-virtually/fill.js +1 -0
  343. package/src/slot-fill/slot.js +1 -1
  344. package/src/slot-fill/use-slot.js +6 -16
  345. package/src/snackbar/index.tsx +6 -5
  346. package/src/snackbar/list.tsx +4 -2
  347. package/src/snackbar/types.ts +18 -92
  348. package/src/tab-panel/index.tsx +38 -16
  349. package/src/tab-panel/style.scss +8 -0
  350. package/src/tab-panel/test/index.tsx +35 -7
  351. package/src/tab-panel/types.ts +1 -1
  352. package/src/theme/test/index.tsx +4 -4
  353. package/src/toggle-group-control/stories/index.tsx +1 -0
  354. package/src/toggle-group-control/test/index.tsx +7 -23
  355. package/src/toolbar/stories/index.js +75 -72
  356. package/src/tools-panel/stories/index.js +3 -0
  357. package/src/tools-panel/test/index.js +1 -1
  358. package/src/tree-grid/index.js +1 -1
  359. package/src/tree-select/index.tsx +3 -6
  360. package/src/ui/context/test/context-connect.tsx +2 -0
  361. package/src/ui/context/test/wordpress-component.tsx +2 -0
  362. package/src/unit-control/test/index.tsx +21 -74
  363. package/src/utils/hooks/test/use-latest-ref.js +15 -18
  364. package/tsconfig.json +1 -4
  365. package/tsconfig.tsbuildinfo +1 -1
  366. package/build-types/radio-context/index.d.ts +0 -6
  367. package/build-types/radio-context/index.d.ts.map +0 -1
  368. package/src/button/stories/index.js +0 -179
  369. package/src/keyboard-shortcuts/index.js +0 -56
  370. package/src/notice/list.js +0 -48
  371. package/src/notice/stories/index.js +0 -46
  372. package/src/query-controls/author-select.js +0 -23
  373. package/src/query-controls/category-select.js +0 -31
  374. package/src/query-controls/index.js +0 -122
  375. package/src/query-controls/terms.js +0 -40
  376. package/src/toolbar/stories/toolbar-button.js +0 -32
  377. package/src/toolbar/stories/toolbar-group.js +0 -33
@@ -20,7 +20,6 @@ function UnconnectedHStack(
20
20
  *
21
21
  * `HStack` can render anything inside.
22
22
  *
23
- * @example
24
23
  * ```jsx
25
24
  * import {
26
25
  * __experimentalHStack as HStack,
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { act, render } from '@testing-library/react';
4
+ import { render, waitFor } from '@testing-library/react';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -13,8 +13,6 @@ import { addFilter, removeAllFilters, removeFilter } from '@wordpress/hooks';
13
13
  */
14
14
  import withFilters from '..';
15
15
 
16
- jest.useFakeTimers();
17
-
18
16
  describe( 'withFilters', () => {
19
17
  const hookName = 'EnhancedComponent';
20
18
  const MyComponent = () => <div>My component</div>;
@@ -65,7 +63,7 @@ describe( 'withFilters', () => {
65
63
  expect( container ).toMatchSnapshot();
66
64
  } );
67
65
 
68
- it( 'should not re-render component when new filter added before component was mounted', () => {
66
+ it( 'should not re-render component when new filter added before component was mounted', async () => {
69
67
  const SpiedComponent = jest.fn( () => <div>Spied component</div> );
70
68
  addFilter(
71
69
  hookName,
@@ -81,13 +79,13 @@ describe( 'withFilters', () => {
81
79
 
82
80
  const { container } = render( <EnhancedComponent /> );
83
81
 
84
- act( () => jest.runAllTimers() );
85
-
86
- expect( SpiedComponent ).toHaveBeenCalledTimes( 1 );
82
+ await waitFor( () =>
83
+ expect( SpiedComponent ).toHaveBeenCalledTimes( 1 )
84
+ );
87
85
  expect( container ).toMatchSnapshot();
88
86
  } );
89
87
 
90
- it( 'should re-render component once when new filter added after component was mounted', () => {
88
+ it( 'should re-render component once when new filter added after component was mounted', async () => {
91
89
  const SpiedComponent = jest.fn( () => <div>Spied component</div> );
92
90
  const EnhancedComponent = withFilters( hookName )( SpiedComponent );
93
91
 
@@ -106,13 +104,13 @@ describe( 'withFilters', () => {
106
104
  )
107
105
  );
108
106
 
109
- act( () => jest.runAllTimers() );
110
-
111
- expect( SpiedComponent ).toHaveBeenCalledTimes( 1 );
107
+ await waitFor( () =>
108
+ expect( SpiedComponent ).toHaveBeenCalledTimes( 1 )
109
+ );
112
110
  expect( container ).toMatchSnapshot();
113
111
  } );
114
112
 
115
- it( 'should re-render component once when two filters added in the same animation frame', () => {
113
+ it( 'should re-render component once when two filters added in the same animation frame', async () => {
116
114
  const SpiedComponent = jest.fn( () => <div>Spied component</div> );
117
115
  const EnhancedComponent = withFilters( hookName )( SpiedComponent );
118
116
 
@@ -141,13 +139,13 @@ describe( 'withFilters', () => {
141
139
  )
142
140
  );
143
141
 
144
- act( () => jest.runAllTimers() );
145
-
146
- expect( SpiedComponent ).toHaveBeenCalledTimes( 1 );
142
+ await waitFor( () =>
143
+ expect( SpiedComponent ).toHaveBeenCalledTimes( 1 )
144
+ );
147
145
  expect( container ).toMatchSnapshot();
148
146
  } );
149
147
 
150
- it( 'should re-render component twice when new filter added and removed in two different animation frames', () => {
148
+ it( 'should re-render component twice when new filter added and removed in two different animation frames', async () => {
151
149
  const SpiedComponent = jest.fn( () => <div>Spied component</div> );
152
150
  const EnhancedComponent = withFilters( hookName )( SpiedComponent );
153
151
  const { container } = render( <EnhancedComponent /> );
@@ -165,17 +163,19 @@ describe( 'withFilters', () => {
165
163
  )
166
164
  );
167
165
 
168
- act( () => jest.runAllTimers() );
166
+ await waitFor( () =>
167
+ expect( SpiedComponent ).toHaveBeenCalledTimes( 1 )
168
+ );
169
169
 
170
170
  removeFilter( hookName, 'test/enhanced-component-spy' );
171
171
 
172
- act( () => jest.runAllTimers() );
173
-
174
- expect( SpiedComponent ).toHaveBeenCalledTimes( 2 );
172
+ await waitFor( () =>
173
+ expect( SpiedComponent ).toHaveBeenCalledTimes( 2 )
174
+ );
175
175
  expect( container ).toMatchSnapshot();
176
176
  } );
177
177
 
178
- it( 'should re-render both components once each when one filter added', () => {
178
+ it( 'should re-render both components once each when one filter added', async () => {
179
179
  const SpiedComponent = jest.fn( () => <div>Spied component</div> );
180
180
  const EnhancedComponent = withFilters( hookName )( SpiedComponent );
181
181
 
@@ -200,9 +200,9 @@ describe( 'withFilters', () => {
200
200
  )
201
201
  );
202
202
 
203
- act( () => jest.runAllTimers() );
204
-
205
- expect( SpiedComponent ).toHaveBeenCalledTimes( 2 );
203
+ await waitFor( () =>
204
+ expect( SpiedComponent ).toHaveBeenCalledTimes( 2 )
205
+ );
206
206
  expect( container ).toMatchSnapshot();
207
207
  } );
208
208
  } );
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { render, screen } from '@testing-library/react';
4
+ import { render, screen, waitFor } from '@testing-library/react';
5
5
  import userEvent from '@testing-library/user-event';
6
6
 
7
7
  /**
@@ -14,8 +14,6 @@ import { Component } from '@wordpress/element';
14
14
  */
15
15
  import withFocusOutside from '../';
16
16
 
17
- jest.useFakeTimers();
18
-
19
17
  let onFocusOutside;
20
18
 
21
19
  describe( 'withFocusOutside', () => {
@@ -57,7 +55,7 @@ describe( 'withFocusOutside', () => {
57
55
  document.hasFocus = origHasFocus;
58
56
  } );
59
57
 
60
- it( 'should not call handler if focus shifts to element within component', () => {
58
+ it( 'should not call handler if focus shifts to element within component', async () => {
61
59
  render( <TestComponent onFocusOutside={ onFocusOutside } /> );
62
60
 
63
61
  const input = screen.getByRole( 'textbox' );
@@ -67,15 +65,11 @@ describe( 'withFocusOutside', () => {
67
65
  input.blur();
68
66
  button.focus();
69
67
 
70
- jest.runAllTimers();
71
-
72
- expect( onFocusOutside ).not.toHaveBeenCalled();
68
+ await waitFor( () => expect( onFocusOutside ).not.toHaveBeenCalled() );
73
69
  } );
74
70
 
75
71
  it( 'should not call handler if focus transitions via click to button', async () => {
76
- const user = userEvent.setup( {
77
- advanceTimers: jest.advanceTimersByTime,
78
- } );
72
+ const user = userEvent.setup();
79
73
  render( <TestComponent onFocusOutside={ onFocusOutside } /> );
80
74
 
81
75
  const input = screen.getByRole( 'textbox' );
@@ -84,24 +78,20 @@ describe( 'withFocusOutside', () => {
84
78
  input.focus();
85
79
  await user.click( button );
86
80
 
87
- jest.runAllTimers();
88
-
89
- expect( onFocusOutside ).not.toHaveBeenCalled();
81
+ await waitFor( () => expect( onFocusOutside ).not.toHaveBeenCalled() );
90
82
  } );
91
83
 
92
- it( 'should call handler if focus doesn’t shift to element within component', () => {
84
+ it( 'should call handler if focus doesn’t shift to element within component', async () => {
93
85
  render( <TestComponent onFocusOutside={ onFocusOutside } /> );
94
86
 
95
87
  const input = screen.getByRole( 'textbox' );
96
88
  input.focus();
97
89
  input.blur();
98
90
 
99
- jest.runAllTimers();
100
-
101
- expect( onFocusOutside ).toHaveBeenCalled();
91
+ await waitFor( () => expect( onFocusOutside ).toHaveBeenCalled() );
102
92
  } );
103
93
 
104
- it( 'should not call handler if focus shifts outside the component when the document does not have focus', () => {
94
+ it( 'should not call handler if focus shifts outside the component when the document does not have focus', async () => {
105
95
  render( <TestComponent onFocusOutside={ onFocusOutside } /> );
106
96
 
107
97
  // Force document.hasFocus() to return false to simulate the window/document losing focus
@@ -112,12 +102,10 @@ describe( 'withFocusOutside', () => {
112
102
  input.focus();
113
103
  input.blur();
114
104
 
115
- jest.runAllTimers();
116
-
117
- expect( onFocusOutside ).not.toHaveBeenCalled();
105
+ await waitFor( () => expect( onFocusOutside ).not.toHaveBeenCalled() );
118
106
  } );
119
107
 
120
- it( 'should cancel check when unmounting while queued', () => {
108
+ it( 'should cancel check when unmounting while queued', async () => {
121
109
  const { rerender } = render(
122
110
  <TestComponent onFocusOutside={ onFocusOutside } />
123
111
  );
@@ -128,8 +116,6 @@ describe( 'withFocusOutside', () => {
128
116
 
129
117
  rerender( <div /> );
130
118
 
131
- jest.runAllTimers();
132
-
133
- expect( onFocusOutside ).not.toHaveBeenCalled();
119
+ await waitFor( () => expect( onFocusOutside ).not.toHaveBeenCalled() );
134
120
  } );
135
121
  } );
@@ -14,8 +14,6 @@ import { Component } from '@wordpress/element';
14
14
  */
15
15
  import withFocusReturn from '../';
16
16
 
17
- jest.useFakeTimers();
18
-
19
17
  class Test extends Component {
20
18
  render() {
21
19
  const { className, focusHistory } = this.props;
@@ -86,9 +84,7 @@ describe( 'withFocusReturn()', () => {
86
84
  } );
87
85
 
88
86
  it( 'should switch focus back when unmounted while having focus', async () => {
89
- const user = userEvent.setup( {
90
- advanceTimers: jest.advanceTimersByTime,
91
- } );
87
+ const user = userEvent.setup();
92
88
 
93
89
  const { unmount } = render( <Composite />, {
94
90
  container: document.body.appendChild(
@@ -226,7 +226,9 @@ function InputField(
226
226
  onMouseDown={ handleOnMouseDown }
227
227
  ref={ ref }
228
228
  inputSize={ size }
229
- value={ value }
229
+ // Fallback to `''` to avoid "uncontrolled to controlled" warning.
230
+ // See https://github.com/WordPress/gutenberg/pull/47250 for details.
231
+ value={ value ?? '' }
230
232
  type={ type }
231
233
  />
232
234
  );
@@ -14,12 +14,7 @@ import { useState } from '@wordpress/element';
14
14
  */
15
15
  import BaseInputControl from '../';
16
16
 
17
- jest.useFakeTimers();
18
-
19
- const setupUser = () =>
20
- userEvent.setup( {
21
- advanceTimers: jest.advanceTimersByTime,
22
- } );
17
+ const setupUser = () => userEvent.setup();
23
18
 
24
19
  const getInput = () => screen.getByTestId( 'input' );
25
20
 
@@ -9,13 +9,9 @@ import userEvent from '@testing-library/user-event';
9
9
  */
10
10
  import IsolatedEventContainer from '../';
11
11
 
12
- jest.useFakeTimers();
13
-
14
12
  describe( 'IsolatedEventContainer', () => {
15
13
  it( 'should pass props to container', async () => {
16
- const user = userEvent.setup( {
17
- advanceTimers: jest.advanceTimersByTime,
18
- } );
14
+ const user = userEvent.setup();
19
15
  const clickHandler = jest.fn();
20
16
  render(
21
17
  <IsolatedEventContainer
@@ -47,9 +43,7 @@ describe( 'IsolatedEventContainer', () => {
47
43
  } );
48
44
 
49
45
  it( 'should stop event propagation only for mousedown, but not for keydown', async () => {
50
- const user = userEvent.setup( {
51
- advanceTimers: jest.advanceTimersByTime,
52
- } );
46
+ const user = userEvent.setup();
53
47
 
54
48
  const mousedownHandler = jest.fn();
55
49
  const keydownHandler = jest.fn();
@@ -41,7 +41,7 @@ The component accepts the following props:
41
41
 
42
42
  Elements to render, upon whom key events are to be monitored.
43
43
 
44
- - Type: `Element` | `Element[]`
44
+ - Type: `ReactNode`
45
45
  - Required: No
46
46
 
47
47
  ### shortcuts
@@ -0,0 +1,93 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useRef, Children } from '@wordpress/element';
5
+ import { useKeyboardShortcut } from '@wordpress/compose';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import type { KeyboardShortcutProps, KeyboardShortcutsProps } from './types';
11
+
12
+ function KeyboardShortcut( {
13
+ target,
14
+ callback,
15
+ shortcut,
16
+ bindGlobal,
17
+ eventName,
18
+ }: KeyboardShortcutProps ) {
19
+ useKeyboardShortcut( shortcut, callback, {
20
+ bindGlobal,
21
+ target,
22
+ eventName,
23
+ } );
24
+
25
+ return null;
26
+ }
27
+
28
+ /**
29
+ * `KeyboardShortcuts` is a component which handles keyboard sequences during the lifetime of the rendering element.
30
+ *
31
+ * When passed children, it will capture key events which occur on or within the children. If no children are passed, events are captured on the document.
32
+ *
33
+ * It uses the [Mousetrap](https://craig.is/killing/mice) library to implement keyboard sequence bindings.
34
+ *
35
+ * ```jsx
36
+ * import { KeyboardShortcuts } from '@wordpress/components';
37
+ * import { useState } from '@wordpress/element';
38
+ *
39
+ * const MyKeyboardShortcuts = () => {
40
+ * const [ isAllSelected, setIsAllSelected ] = useState( false );
41
+ * const selectAll = () => {
42
+ * setIsAllSelected( true );
43
+ * };
44
+ *
45
+ * return (
46
+ * <div>
47
+ * <KeyboardShortcuts
48
+ * shortcuts={ {
49
+ * 'mod+a': selectAll,
50
+ * } }
51
+ * />
52
+ * [cmd/ctrl + A] Combination pressed? { isAllSelected ? 'Yes' : 'No' }
53
+ * </div>
54
+ * );
55
+ * };
56
+ * ```
57
+ */
58
+ function KeyboardShortcuts( {
59
+ children,
60
+ shortcuts,
61
+ bindGlobal,
62
+ eventName,
63
+ }: KeyboardShortcutsProps ) {
64
+ const target = useRef( null );
65
+
66
+ const element = Object.entries( shortcuts ?? {} ).map(
67
+ ( [ shortcut, callback ] ) => (
68
+ <KeyboardShortcut
69
+ key={ shortcut }
70
+ shortcut={ shortcut }
71
+ callback={ callback }
72
+ bindGlobal={ bindGlobal }
73
+ eventName={ eventName }
74
+ target={ target }
75
+ />
76
+ )
77
+ );
78
+
79
+ // Render as non-visual if there are no children pressed. Keyboard
80
+ // events will be bound to the document instead.
81
+ if ( ! Children.count( children ) ) {
82
+ return <>{ element }</>;
83
+ }
84
+
85
+ return (
86
+ <div ref={ target }>
87
+ { element }
88
+ { children }
89
+ </div>
90
+ );
91
+ }
92
+
93
+ export default KeyboardShortcuts;
@@ -0,0 +1,60 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type { ComponentMeta, ComponentStory } from '@storybook/react';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import KeyboardShortcuts from '..';
10
+
11
+ const meta: ComponentMeta< typeof KeyboardShortcuts > = {
12
+ component: KeyboardShortcuts,
13
+ title: 'Components/KeyboardShortcuts',
14
+ parameters: {
15
+ controls: { expanded: true },
16
+ docs: { source: { state: 'open' } },
17
+ },
18
+ };
19
+ export default meta;
20
+
21
+ const Template: ComponentStory< typeof KeyboardShortcuts > = ( props ) => (
22
+ <KeyboardShortcuts { ...props } />
23
+ );
24
+
25
+ export const Default = Template.bind( {} );
26
+ Default.args = {
27
+ shortcuts: {
28
+ // eslint-disable-next-line no-alert
29
+ a: () => window.alert( 'You hit "a"!' ),
30
+ // eslint-disable-next-line no-alert
31
+ b: () => window.alert( 'You hit "b"!' ),
32
+ },
33
+ children: (
34
+ <div>
35
+ <p>{ `Hit the "a" or "b" key in this textarea:` }</p>
36
+ <textarea />
37
+ </div>
38
+ ),
39
+ };
40
+ Default.parameters = {
41
+ docs: {
42
+ source: {
43
+ code: `
44
+ <KeyboardShortcuts
45
+ shortcuts={{
46
+ a: () => window.alert('You hit "a"!'),
47
+ b: () => window.alert('You hit "b"!'),
48
+ }}
49
+ >
50
+ <div>
51
+ <p>
52
+ Hit the "a" or "b" key in this textarea:
53
+ </p>
54
+ <textarea />
55
+ </div>
56
+ </KeyboardShortcuts>
57
+ `,
58
+ },
59
+ },
60
+ };
@@ -1,19 +1,29 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { fireEvent, render, screen } from '@testing-library/react';
4
+ import { createEvent, fireEvent, render, screen } from '@testing-library/react';
5
5
 
6
6
  /**
7
7
  * Internal dependencies
8
8
  */
9
- import KeyboardShortcuts from '../';
9
+ import KeyboardShortcuts from '..';
10
10
 
11
11
  describe( 'KeyboardShortcuts', () => {
12
- function keyPress( which, target ) {
12
+ function keyPress(
13
+ which: KeyboardEvent[ 'which' ],
14
+ target: Parameters< typeof fireEvent >[ 0 ]
15
+ ) {
13
16
  [ 'keydown', 'keypress', 'keyup' ].forEach( ( eventName ) => {
14
- const event = new window.Event( eventName, { bubbles: true } );
15
- event.keyCode = which;
16
- event.which = which;
17
+ const event = createEvent(
18
+ eventName,
19
+ target,
20
+ {
21
+ bubbles: true,
22
+ keyCode: which,
23
+ which,
24
+ },
25
+ { EventType: 'KeyboardEvent' }
26
+ );
17
27
  fireEvent( target, event );
18
28
  } );
19
29
  }
@@ -0,0 +1,51 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import type { useKeyboardShortcut } from '@wordpress/compose';
5
+
6
+ // TODO: We wouldn't have to do this if this type was exported from `@wordpress/compose`.
7
+ type WPKeyboardShortcutConfig = NonNullable<
8
+ Parameters< typeof useKeyboardShortcut >[ 2 ]
9
+ >;
10
+
11
+ export type KeyboardShortcutProps = {
12
+ shortcut: string | string[];
13
+ /**
14
+ * @see {@link https://craig.is/killing/mice Mousetrap documentation}
15
+ */
16
+ callback: ( event: Mousetrap.ExtendedKeyboardEvent, combo: string ) => void;
17
+ } & Pick< WPKeyboardShortcutConfig, 'bindGlobal' | 'eventName' | 'target' >;
18
+
19
+ export type KeyboardShortcutsProps = {
20
+ /**
21
+ * Elements to render, upon whom key events are to be monitored.
22
+ */
23
+ children?: React.ReactNode;
24
+ /**
25
+ * An object of shortcut bindings, where each key is a keyboard combination,
26
+ * the value of which is the callback to be invoked when the key combination is pressed.
27
+ *
28
+ * The value of each shortcut should be a consistent function reference, not an anonymous function.
29
+ * Otherwise, the callback will not be correctly unbound when the component unmounts.
30
+ *
31
+ * The `KeyboardShortcuts` component will not update to reflect a changed `shortcuts` prop.
32
+ * If you need to change shortcuts, mount a separate `KeyboardShortcuts` element,
33
+ * which can be achieved by assigning a unique `key` prop.
34
+ *
35
+ * @see {@link https://craig.is/killing/mice Mousetrap documentation}
36
+ */
37
+ shortcuts: Record< string, KeyboardShortcutProps[ 'callback' ] >;
38
+ /**
39
+ * By default, a callback will not be invoked if the key combination occurs in an editable field.
40
+ * Pass `bindGlobal` as `true` if the key events should be observed globally, including within editable fields.
41
+ *
42
+ * Tip: If you need some but not all keyboard events to be observed globally,
43
+ * simply render two distinct `KeyboardShortcuts` elements, one with and one without the `bindGlobal` prop.
44
+ */
45
+ bindGlobal?: KeyboardShortcutProps[ 'bindGlobal' ];
46
+ /**
47
+ * By default, a callback is invoked in response to the `keydown` event.
48
+ * To override this, pass `eventName` with the name of a specific keyboard event.
49
+ */
50
+ eventName?: KeyboardShortcutProps[ 'eventName' ];
51
+ };
@@ -202,8 +202,7 @@ function UnforwardedModal(
202
202
  onClick={ onRequestClose }
203
203
  icon={ close }
204
204
  label={
205
- closeButtonLabel ||
206
- __( 'Close dialog' )
205
+ closeButtonLabel || __( 'Close' )
207
206
  }
208
207
  />
209
208
  ) }
@@ -9,8 +9,6 @@ import userEvent from '@testing-library/user-event';
9
9
  */
10
10
  import { NavigableMenu } from '../menu';
11
11
 
12
- jest.useFakeTimers();
13
-
14
12
  const NavigableMenuTestCase = ( props ) => (
15
13
  <NavigableMenu { ...props }>
16
14
  <button>Item 1</button>
@@ -46,9 +44,7 @@ describe( 'NavigableMenu', () => {
46
44
  } );
47
45
 
48
46
  it( 'moves focus on its focusable children by using the up/down arrow keys', async () => {
49
- const user = userEvent.setup( {
50
- advanceTimers: jest.advanceTimersByTime,
51
- } );
47
+ const user = userEvent.setup();
52
48
 
53
49
  const onNavigateSpy = jest.fn();
54
50
 
@@ -87,9 +83,7 @@ describe( 'NavigableMenu', () => {
87
83
  } );
88
84
 
89
85
  it( 'moves focus on its focusable children by using the left/right arrow keys when the `orientation`prop is set to `horizontal', async () => {
90
- const user = userEvent.setup( {
91
- advanceTimers: jest.advanceTimersByTime,
92
- } );
86
+ const user = userEvent.setup();
93
87
 
94
88
  const onNavigateSpy = jest.fn();
95
89
 
@@ -133,9 +127,7 @@ describe( 'NavigableMenu', () => {
133
127
  } );
134
128
 
135
129
  it( 'should stop at the edges when the `cycle` prop is set to `false`', async () => {
136
- const user = userEvent.setup( {
137
- advanceTimers: jest.advanceTimersByTime,
138
- } );
130
+ const user = userEvent.setup();
139
131
 
140
132
  const onNavigateSpy = jest.fn();
141
133
 
@@ -193,9 +185,7 @@ describe( 'NavigableMenu', () => {
193
185
  } );
194
186
 
195
187
  it( 'stops keydown event propagation when arrow keys are pressed, regardless of the `orientation` prop', async () => {
196
- const user = userEvent.setup( {
197
- advanceTimers: jest.advanceTimersByTime,
198
- } );
188
+ const user = userEvent.setup();
199
189
 
200
190
  const externalWrapperOnKeyDownSpy = jest.fn();
201
191
 
@@ -224,9 +214,7 @@ describe( 'NavigableMenu', () => {
224
214
  } );
225
215
 
226
216
  it( 'skips its internal logic when the tab key is pressed', async () => {
227
- const user = userEvent.setup( {
228
- advanceTimers: jest.advanceTimersByTime,
229
- } );
217
+ const user = userEvent.setup();
230
218
 
231
219
  render(
232
220
  <>
@@ -9,8 +9,6 @@ import userEvent from '@testing-library/user-event';
9
9
  */
10
10
  import { TabbableContainer } from '../tabbable';
11
11
 
12
- jest.useFakeTimers();
13
-
14
12
  const TabbableContainerTestCase = ( props ) => (
15
13
  <TabbableContainer { ...props }>
16
14
  <button>Item 1</button>
@@ -49,9 +47,7 @@ describe( 'TabbableContainer', () => {
49
47
  } );
50
48
 
51
49
  it( 'moves focus on its tabbable children by using the tab key', async () => {
52
- const user = userEvent.setup( {
53
- advanceTimers: jest.advanceTimersByTime,
54
- } );
50
+ const user = userEvent.setup();
55
51
 
56
52
  const onNavigateSpy = jest.fn();
57
53
 
@@ -80,9 +76,7 @@ describe( 'TabbableContainer', () => {
80
76
  } );
81
77
 
82
78
  it( 'should stop at the edges when the `cycle` prop is set to `false`', async () => {
83
- const user = userEvent.setup( {
84
- advanceTimers: jest.advanceTimersByTime,
85
- } );
79
+ const user = userEvent.setup();
86
80
 
87
81
  const onNavigateSpy = jest.fn();
88
82
 
@@ -141,9 +135,7 @@ describe( 'TabbableContainer', () => {
141
135
  } );
142
136
 
143
137
  it( 'stops keydown event propagation when the tab key is pressed', async () => {
144
- const user = userEvent.setup( {
145
- advanceTimers: jest.advanceTimersByTime,
146
- } );
138
+ const user = userEvent.setup();
147
139
 
148
140
  const externalWrapperOnKeyDownSpy = jest.fn();
149
141