Skip to content

Commit

Permalink
Documentation updates based on feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
brookewp committed Sep 14, 2023
1 parent 96d1cb1 commit c26f863
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@

- `DropdownMenu` v2: Fix submenu chevron direction in RTL languages ([#54036](https://github.com/WordPress/gutenberg/pull/54036).

### New Features

- `Tooltip`: Add `placement` prop to replace deprecated `position`([#54264](https://github.com/WordPress/gutenberg/pull/54264)).

## 25.7.0 (2023-08-31)

### Breaking changes
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ export function UnforwardedButton(
</button>
);

// use floating-ui's `placement` instead of legacy `position`
// Convert legacy `position` values to be used with the new `placement` prop
let computedPlacement;
// if `tooltipPosition` is defined, compute value to `placement`
if ( tooltipPosition !== undefined ) {
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/tooltip/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Option to hide the tooltip when the anchor is clicked.

#### `placement`: `'top' | 'top-start' | 'top-end' | 'right' | 'right-start' | 'right-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end'`

Used to specify the tooltip's placement with respect to its anchor. Further details and examples can be found in `floating-ui`'s [documentation for 'Placements'](https://floating-ui.com/docs/tutorial#placements).
Used to specify the tooltip's placement with respect to its anchor.

- Required: No
- Default: `'bottom'`
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/tooltip/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function Tooltip( props: TooltipProps ) {
// Compute tooltip's placement:
// - give priority to `placement` prop, if defined
// - otherwise, compute it from the legacy `position` prop (if defined)
// - finally, fallback to the DEFAULT_PLACEMENT.
// - finally, fallback to the default placement: 'bottom'
let computedPlacement;
if ( placement !== undefined ) {
computedPlacement = placement;
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/tooltip/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export type TooltipProps = {
* `"bottom"` y axis, and `"left"`, `"center"`, `"right"` x axis.
* Where the tooltip should be positioned relative to its parent.
*
* @deprecated
* @default bottom
*/
position?: PopoverProps[ 'position' ];
Expand Down

0 comments on commit c26f863

Please sign in to comment.