Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ ion-picker,css-prop,--min-width
ion-picker,css-prop,--width

ion-popover,shadow
ion-popover,prop,alignment,"center" | "end" | "start",'start',false,false
ion-popover,prop,alignment,"center" | "end" | "start" | undefined,undefined,false,false
ion-popover,prop,animated,boolean,true,false,false
ion-popover,prop,arrow,boolean,true,false,false
ion-popover,prop,backdropDismiss,boolean,true,false,false
Expand Down
6 changes: 3 additions & 3 deletions core/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1848,9 +1848,9 @@ export namespace Components {
}
interface IonPopover {
/**
* Describes how to align the popover content with the `reference` point.
* Describes how to align the popover content with the `reference` point. Defaults to `'center'` for `ios` mode, and `'start'` for `md` mode.
*/
"alignment": PositionAlign;
"alignment"?: PositionAlign;
/**
* If `true`, the popover will animate.
*/
Expand Down Expand Up @@ -5485,7 +5485,7 @@ declare namespace LocalJSX {
}
interface IonPopover {
/**
* Describes how to align the popover content with the `reference` point.
* Describes how to align the popover content with the `reference` point. Defaults to `'center'` for `ios` mode, and `'start'` for `md` mode.
*/
"alignment"?: PositionAlign;
/**
Expand Down
7 changes: 6 additions & 1 deletion core/src/components/popover/popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,9 @@ export class Popover implements ComponentInterface, PopoverInterface {

/**
* Describes how to align the popover content with the `reference` point.
* Defaults to `'center'` for `ios` mode, and `'start'` for `md` mode.
*/
@Prop() alignment: PositionAlign = 'start';
@Prop({ mutable: true }) alignment?: PositionAlign;

/**
* If `true`, the popover will display an arrow
Expand Down Expand Up @@ -292,6 +293,10 @@ export class Popover implements ComponentInterface, PopoverInterface {
this.popoverId = (this.el.hasAttribute('id')) ? this.el.getAttribute('id')! : `ion-popover-${this.popoverIndex}`;

this.parentPopover = this.el.closest(`ion-popover:not(#${this.popoverId})`) as HTMLIonPopoverElement | null;

if (this.alignment === undefined) {
this.alignment = getIonMode(this) === 'ios' ? 'center' : 'start';
}
}

componentDidLoad() {
Expand Down
2 changes: 1 addition & 1 deletion core/src/components/popover/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,7 @@ export default {

| Property | Attribute | Description | Type | Default |
| ----------------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ | ----------- |
| `alignment` | `alignment` | Describes how to align the popover content with the `reference` point. | `"center" \| "end" \| "start"` | `'start'` |
| `alignment` | `alignment` | Describes how to align the popover content with the `reference` point. Defaults to `'center'` for `ios` mode, and `'start'` for `md` mode. | `"center" \| "end" \| "start" \| undefined` | `undefined` |
| `animated` | `animated` | If `true`, the popover will animate. | `boolean` | `true` |
| `arrow` | `arrow` | If `true`, the popover will display an arrow that points at the `reference` when running in `ios` mode on mobile. Does not apply in `md` mode or on desktop. | `boolean` | `true` |
| `backdropDismiss` | `backdrop-dismiss` | If `true`, the popover will be dismissed when the backdrop is clicked. | `boolean` | `true` |
Expand Down