Skip to content
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

fix(angular): popover arrow navigation with disabled items #29662

Merged
merged 3 commits into from
Jun 26, 2024
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 @@ -783,7 +783,7 @@ ion-item,prop,button,boolean,false,false,false
ion-item,prop,color,"danger" | "dark" | "light" | "medium" | "primary" | "secondary" | "success" | "tertiary" | "warning" | string & Record<never, never> | undefined,undefined,false,true
ion-item,prop,detail,boolean | undefined,undefined,false,false
ion-item,prop,detailIcon,string,chevronForward,false,false
ion-item,prop,disabled,boolean,false,false,false
ion-item,prop,disabled,boolean,false,false,true
ion-item,prop,download,string | undefined,undefined,false,false
ion-item,prop,href,string | undefined,undefined,false,false
ion-item,prop,lines,"full" | "inset" | "none" | undefined,undefined,false,false
Expand Down
2 changes: 1 addition & 1 deletion core/src/components/item/item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class Item implements ComponentInterface, AnchorInterface, ButtonInterfac
/**
* If `true`, the user cannot interact with the item.
*/
@Prop() disabled = false;
@Prop({ reflect: true }) disabled = false;

/**
* This attribute instructs browsers to download a URL instead of navigating to
Expand Down
10 changes: 10 additions & 0 deletions packages/angular/test/base/e2e/src/lazy/popover.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,14 @@ describe('Popovers: Inline', () => {
cy.get('ion-list ion-item:nth-child(3)').should('have.text', 'C');
cy.get('ion-list ion-item:nth-child(4)').should('have.text', 'D');
});

it('should have an item with a disabled attribute', () => {
cy.get('ion-button').click();

cy.get('ion-popover').should('be.visible');

cy.wait(1500);

cy.get('ion-list ion-item:nth-child(3)').should('have.attr', 'disabled');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,10 @@
Accordions Test
</ion-label>
</ion-item>
<ion-item routerLink="/lazy/popover-inline">
<ion-label>
Popovers
</ion-label>
</ion-item>
</ion-list>
</ion-content>
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<ng-template>
<ion-content>
<ion-list>
<ion-item *ngFor="let item of items">
<ion-label>{{ item }}</ion-label>
<ion-item *ngFor="let item of items" [button]="true" [disabled]="item.disabled">
<ion-label>{{ item.text }}</ion-label>
</ion-item>
</ion-list>
</ion-content>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ import { IonPopover } from "@ionic/angular";
})
export class PopoverInlineComponent {

items: string[] = [];
items: {text: string, disabled?: boolean}[] = [];

openPopover(popover: IonPopover) {
popover.present();

setTimeout(() => {
this.items = ['A', 'B', 'C', 'D'];
this.items = [{text: 'A'}, {text: 'B'}, {text: 'C', disabled: true}, {text: 'D'}];
}, 1000);
}

Expand Down
Loading