Skip to content

Commit

Permalink
fix(Popup): remove default placement
Browse files Browse the repository at this point in the history
  • Loading branch information
amje committed Dec 28, 2024
1 parent ca226a5 commit 8882a21
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/Popup/Popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export function Popup({
open = false,
onOpenChange,
strategy,
placement: placementProp = 'top',
placement: placementProp,
offset: offsetProp = 4,
anchorElement,
anchorRef,
Expand Down
2 changes: 1 addition & 1 deletion src/components/Popup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ LANDING_BLOCK-->
| onTransitionExit | On start close popup animation | `Function` | |
| onTransitionExited | On finish close popup animation | `Function` | |
| open | Manages `Popup` visibility | `boolean` | `false` |
| placement | `Floating UI` placement | `Placement` `Array<Placement>` `auto` `auto-start` `auto-end` | `top` |
| placement | `Floating UI` placement | `Placement` `Array<Placement>` `auto` `auto-start` `auto-end` | |
| qa | Test attribute (`data-qa`) | `string` | |
| restoreFocus | If true, the focus will return to the anchor element | `boolean` | `false` |
| restoreFocusRef | Element the focus will be restored to | `React.RefObject` | |
Expand Down
6 changes: 3 additions & 3 deletions src/components/Popup/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ export function getOffsetOptions(offsetProp: PopupOffset, hasArrow: boolean | un
return {offset};
}

function isAutoPlacement(placement: string): placement is AutoPlacement {
return AUTO_PLACEMENTS.includes(placement as AutoPlacement);
function isAutoPlacement(placement?: string): placement is AutoPlacement {
return Boolean(placement && AUTO_PLACEMENTS.includes(placement as AutoPlacement));
}

export function getPlacementOptions(placementProp: PopupPlacement, disablePortal?: boolean) {
export function getPlacementOptions(placementProp?: PopupPlacement, disablePortal?: boolean) {
let placement: Placement | undefined;
let middleware: Middleware;

Expand Down

0 comments on commit 8882a21

Please sign in to comment.