Skip to content

Commit

Permalink
Try padding the vertical toolbars shift range
Browse files Browse the repository at this point in the history
  • Loading branch information
stokesman committed Jul 16, 2024
1 parent 558c976 commit 1035b1c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default function ZoomOutPopover( { clientId, __unstableContentRef } ) {
...popoverProps,
placement: 'left-start',
flip: false,
shift: { padding: { top: 48, bottom: 48 } },
};

return (
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/popover/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ const UnforwardedPopover = (
shiftMiddleware( {
crossAxis: true,
limiter: limitShift(),
padding: 1, // Necessary to avoid flickering at the edge of the viewport.
padding: typeof shift === 'boolean' ? 1 : shift.padding ?? 1, // Necessary to avoid flickering at the edge of the viewport.
} ),
arrow( { element: arrowRef } ),
];
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/popover/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* External dependencies
*/
import type { ReactNode, MutableRefObject, SyntheticEvent } from 'react';
import type { Placement } from '@floating-ui/react-dom';
import type { Placement, ShiftOptions } from '@floating-ui/react-dom';

type PositionYAxis = 'top' | 'middle' | 'bottom';
type PositionXAxis = 'left' | 'center' | 'right';
Expand Down Expand Up @@ -139,7 +139,7 @@ export type PopoverProps = {
*
* @default false
*/
shift?: boolean;
shift?: boolean | ShiftOptions;
/**
* Specifies the popover's style.
*
Expand Down

0 comments on commit 1035b1c

Please sign in to comment.