You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2a17e81
Browse filesBrowse the repository at this point in the historyBrowse files
Migrates 7 consumer call sites in `@wordpress/editor`,
`@wordpress/edit-post`, and `@wordpress/edit-site` from the legacy
`Tooltip` exported by `@wordpress/components` to the compositional
`Tooltip` exported by `@wordpress/ui` (built on top of base-ui under
the hood):
- editor/collab-sidebar/note-byline (non-interactive `<time>` trigger;
visual-only on hover)
- editor/collaborators-presence/avatar (non-interactive `<div role="img">`
trigger; visual-only on hover)
- editor/post-revisions-preview/diff-markers
- editor/resizable-editor/resize-handle
- editor/template-actions-panel/block-theme-content
- edit-post/layout (resize separator)
- edit-site/resizable-frame
The mechanical rewrite was produced by the jscodeshift codemod landed in
PR 1; import placement / ordering and a `jsx-a11y` disable directive
that the codemod could not preserve were finished by hand.
Also mounts a shell-level `<Tooltip.Provider>` inside
`edit-post/layout` and `edit-site/layout`, so tooltips inside each
editor coordinate as a group (e.g. once the first tooltip in a group
has been shown, subsequent siblings open instantly). PR 5 will do the
same for the new dashboard / `@wordpress/boot` shell.
Avatar unit tests previously relied on the legacy `Ariakit.TooltipAnchor`
adding `tabindex="0"` on a non-interactive trigger; they have been
rewritten to verify tooltip *presence* by hovering the avatar and
asserting the popup content becomes visible (wrapped in a
`Tooltip.Provider` with `delay={ 0 }` so the assertion doesn't race the
real-world hover delay).
The `edit-post/layout/index.native.js` consumer is intentionally left
on the legacy import: it uses `<WCTooltip.Slot>`, which is the
SlotFill pattern of the legacy implementation and has no equivalent in
the new compositional `Tooltip`.
Copy file name to clipboardExpand all lines: packages/edit-post/src/components/layout/index.js
+66-57Lines changed: 66 additions & 57 deletions
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,6 @@ import { store as coreStore } from '@wordpress/core-data';
40
40
import{
41
41
IconasWCIcon,
42
42
SlotFillProvider,
43
-
TooltipasWCTooltip,
44
43
__unstableUseNavigateRegionsasuseNavigateRegions,
45
44
privateApisascomponentsPrivateApis,
46
45
}from'@wordpress/components';
@@ -50,7 +49,8 @@ import {
50
49
useRefEffect,
51
50
useViewportMatch,
52
51
}from'@wordpress/compose';
53
-
import{VisuallyHidden}from'@wordpress/ui';
52
+
// eslint-disable-next-line @wordpress/use-recommended-components -- `Tooltip` is not yet on the recommended `@wordpress/ui` allow-list; landing as a migration step ahead of the wider rollout.
// eslint-disable-next-line @wordpress/use-recommended-components -- `Tooltip` is not yet on the recommended `@wordpress/ui` allow-list; landing as a migration step ahead of the wider rollout.
// eslint-disable-next-line @wordpress/use-recommended-components -- `Tooltip` is not yet on the recommended `@wordpress/ui` allow-list; landing as a migration step ahead of the wider rollout.
21
+
import{Tooltip}from'@wordpress/ui';
21
22
22
23
/**
23
24
* Internal dependencies
@@ -294,32 +295,43 @@ function ResizableFrame( {
294
295
handleComponent={{
295
296
[isRTL() ? 'right' : 'left']: canvas==='view'&&(
296
297
<>
297
-
<WCTooltiptext={__('Drag to resize')}>
298
-
<motion.button
299
-
key="handle"
300
-
role="separator"
301
-
aria-orientation="vertical"
302
-
className={clsx(
303
-
'edit-site-resizable-frame__handle',
304
-
{'is-resizing': isResizing}
305
-
)}
306
-
variants={resizeHandleVariants}
307
-
animate={currentResizeHandleVariant}
308
-
aria-label={__('Drag to resize')}
309
-
aria-describedby={resizableHandleHelpId}
310
-
aria-valuenow={
311
-
frameRef.current?.resizable?.offsetWidth||
312
-
undefined
298
+
<Tooltip.Root>
299
+
<Tooltip.Trigger
300
+
render={
301
+
<motion.button
302
+
key="handle"
303
+
role="separator"
304
+
aria-orientation="vertical"
305
+
className={clsx(
306
+
'edit-site-resizable-frame__handle',
307
+
{'is-resizing': isResizing}
308
+
)}
309
+
variants={resizeHandleVariants}
310
+
animate={currentResizeHandleVariant}
311
+
aria-label={__('Drag to resize')}
312
+
aria-describedby={
313
+
resizableHandleHelpId
314
+
}
315
+
aria-valuenow={
316
+
frameRef.current?.resizable
317
+
?.offsetWidth||undefined
318
+
}
319
+
aria-valuemin={FRAME_MIN_WIDTH}
320
+
aria-valuemax={defaultSize.width}
321
+
onKeyDown={
322
+
handleResizableHandleKeyDown
323
+
}
324
+
initial="hidden"
325
+
exit="hidden"
326
+
whileFocus="active"
327
+
whileHover="active"
328
+
/>
313
329
}
314
-
aria-valuemin={FRAME_MIN_WIDTH}
315
-
aria-valuemax={defaultSize.width}
316
-
onKeyDown={handleResizableHandleKeyDown}
317
-
initial="hidden"
318
-
exit="hidden"
319
-
whileFocus="active"
320
-
whileHover="active"
321
330
/>
322
-
</WCTooltip>
331
+
<Tooltip.Popup>
332
+
{__('Drag to resize')}
333
+
</Tooltip.Popup>
334
+
</Tooltip.Root>
323
335
<divhiddenid={resizableHandleHelpId}>
324
336
{__(
325
337
'Use left and right arrow keys to resize the canvas. Hold shift to resize in larger increments.'
// eslint-disable-next-line @wordpress/use-recommended-components -- `Tooltip` is not yet on the recommended `@wordpress/ui` allow-list; landing as a migration step ahead of the wider rollout.
// eslint-disable-next-line @wordpress/use-recommended-components -- `Tooltip` is not yet on the recommended `@wordpress/ui` allow-list; landing as a migration step ahead of the wider rollout.
0 commit comments