-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Tooltip migration: editor + edit-post + edit-site consumers (2/5) #78466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,6 @@ import clsx from 'clsx'; | |
| import { useState, useRef } from '@wordpress/element'; | ||
| import { | ||
| ResizableBox, | ||
| Tooltip as WCTooltip, | ||
| __unstableMotion as motion, | ||
| } from '@wordpress/components'; | ||
| import { useInstanceId, useReducedMotion } from '@wordpress/compose'; | ||
|
|
@@ -18,6 +17,8 @@ import { privateApis as routerPrivateApis } from '@wordpress/router'; | |
| import { useSelect } from '@wordpress/data'; | ||
| import { store as coreStore } from '@wordpress/core-data'; | ||
| import { addQueryArgs } from '@wordpress/url'; | ||
| // 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. | ||
| import { Tooltip } from '@wordpress/ui'; | ||
|
|
||
| /** | ||
| * Internal dependencies | ||
|
|
@@ -294,34 +295,44 @@ function ResizableFrame( { | |
| handleComponent={ { | ||
| [ isRTL() ? 'right' : 'left' ]: canvas === 'view' && ( | ||
| <> | ||
| <WCTooltip text={ __( 'Drag to resize' ) }> | ||
| { /* Disable reason: role="separator" does in fact support aria-valuenow */ } | ||
| { /* eslint-disable-next-line jsx-a11y/role-supports-aria-props */ } | ||
| <motion.button | ||
| key="handle" | ||
| role="separator" | ||
| aria-orientation="vertical" | ||
| className={ clsx( | ||
| 'edit-site-resizable-frame__handle', | ||
| { 'is-resizing': isResizing } | ||
| ) } | ||
| variants={ resizeHandleVariants } | ||
| animate={ currentResizeHandleVariant } | ||
| aria-label={ __( 'Drag to resize' ) } | ||
| aria-describedby={ resizableHandleHelpId } | ||
| aria-valuenow={ | ||
| frameRef.current?.resizable?.offsetWidth || | ||
| undefined | ||
| <Tooltip.Root> | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| <Tooltip.Trigger | ||
| render={ | ||
| /* role="separator" does in fact support aria-valuenow */ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this comment still needed? Looks like it was just there to justify the eslint-disable. |
||
| <motion.button | ||
| key="handle" | ||
| role="separator" | ||
| aria-orientation="vertical" | ||
| className={ clsx( | ||
| 'edit-site-resizable-frame__handle', | ||
| { 'is-resizing': isResizing } | ||
| ) } | ||
| variants={ resizeHandleVariants } | ||
| animate={ currentResizeHandleVariant } | ||
| aria-label={ __( 'Drag to resize' ) } | ||
| aria-describedby={ | ||
| resizableHandleHelpId | ||
| } | ||
| aria-valuenow={ | ||
| frameRef.current?.resizable | ||
| ?.offsetWidth || undefined | ||
| } | ||
| aria-valuemin={ FRAME_MIN_WIDTH } | ||
| aria-valuemax={ defaultSize.width } | ||
| onKeyDown={ | ||
| handleResizableHandleKeyDown | ||
| } | ||
| initial="hidden" | ||
| exit="hidden" | ||
| whileFocus="active" | ||
| whileHover="active" | ||
| /> | ||
| } | ||
| aria-valuemin={ FRAME_MIN_WIDTH } | ||
| aria-valuemax={ defaultSize.width } | ||
| onKeyDown={ handleResizableHandleKeyDown } | ||
| initial="hidden" | ||
| exit="hidden" | ||
| whileFocus="active" | ||
| whileHover="active" | ||
| /> | ||
| </WCTooltip> | ||
| <Tooltip.Popup> | ||
| { __( 'Drag to resize' ) } | ||
| </Tooltip.Popup> | ||
| </Tooltip.Root> | ||
| <div hidden id={ resizableHandleHelpId }> | ||
| { __( | ||
| 'Use left and right arrow keys to resize the canvas. Hold shift to resize in larger increments.' | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| /** | ||
| * WordPress dependencies | ||
| */ | ||
| import { Tooltip as WCTooltip } from '@wordpress/components'; | ||
| import { Stack } from '@wordpress/ui'; | ||
| // 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. | ||
| import { Stack, Tooltip } from '@wordpress/ui'; | ||
| import { __, _x } from '@wordpress/i18n'; | ||
| import { | ||
| dateI18n, | ||
|
|
@@ -95,14 +95,19 @@ export function NoteByline( { avatar, name, date, userId } ) { | |
| { name ?? currentUserName } | ||
| </span> | ||
| { date && ( | ||
| <WCTooltip text={ tooltipText }> | ||
| <time | ||
| dateTime={ commentDateTime } | ||
| className="editor-collab-sidebar-panel__user-time" | ||
| > | ||
| { commentDateText } | ||
| </time> | ||
| </WCTooltip> | ||
| <Tooltip.Root> | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| <Tooltip.Trigger | ||
| render={ | ||
| <time | ||
| dateTime={ commentDateTime } | ||
| className="editor-collab-sidebar-panel__user-time" | ||
| > | ||
| { commentDateText } | ||
| </time> | ||
| } | ||
| /> | ||
| <Tooltip.Popup>{ tooltipText }</Tooltip.Popup> | ||
| </Tooltip.Root> | ||
| ) } | ||
| </Stack> | ||
| </> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,8 +10,10 @@ extend( [ a11yPlugin ] ); | |
| /** | ||
| * WordPress dependencies | ||
| */ | ||
| import { Icon as WCIcon, Tooltip as WCTooltip } from '@wordpress/components'; | ||
| import { Icon as WCIcon } from '@wordpress/components'; | ||
| import { useMemo } from '@wordpress/element'; | ||
| // 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. | ||
| import { Tooltip } from '@wordpress/ui'; | ||
|
|
||
| /** | ||
| * Internal dependencies | ||
|
|
@@ -114,7 +116,12 @@ function Avatar( { | |
| ); | ||
|
|
||
| if ( name && ( ! showBadge || label ) ) { | ||
| return <WCTooltip text={ name }>{ avatar }</WCTooltip>; | ||
| return ( | ||
| <Tooltip.Root> | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| <Tooltip.Trigger render={ avatar } /> | ||
| <Tooltip.Popup>{ name }</Tooltip.Popup> | ||
| </Tooltip.Root> | ||
| ); | ||
| } | ||
|
|
||
| return avatar; | ||
|
|
||



There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.