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

matMenu broken when using yPosition and Ivy #16750

Open
james-schwartzkopf opened this issue Aug 11, 2019 · 1 comment
Open

matMenu broken when using yPosition and Ivy #16750

james-schwartzkopf opened this issue Aug 11, 2019 · 1 comment
Labels
area: material/menu P2 The issue is important to a large percentage of users, with a workaround

Comments

@james-schwartzkopf
Copy link

Reproduction

https://github.com/james-schwartzkopf/ng8-issues/tree/mat-menu-yPosition

Steps to reproduce:

  1. yarn
  2. yarn run build

Expected Behavior

Should compile cleanly and matMenu should appear in expected position.

Actual Behavior

Error:

    ERROR in src/app/app.component.html(15,32): Property 'yPosition' does not exist on type 'HTMLElement'.

Environment

  • Angular: 8.2.1
  • CDK/Material: 8.1.2
@andrewseguin andrewseguin added the P2 The issue is important to a large percentage of users, with a workaround label Aug 13, 2019
@crisbeto
Copy link
Member

I wasn't able to reproduce it against angular/angular with the following unit test:

it('should fail', () => {
  class MatMenuBase {
    @Input() yPosition !: string;
  }

  @Component({
    template: '<ng-content></ng-content>',
    selector: 'mat-menu',
    exportAs: 'matMenu',
  })
  class MatMenu extends MatMenuBase {
  }

  @Directive({selector: '[matMenuTriggerFor]'})
  class MenuTrigger {
    @Input('matMenuTriggerFor') menu !: MatMenu;
  }

  @Component({
    template: `
      <button [matMenuTriggerFor]="menu">Open</button>
      <mat-menu #menu="matMenu" [yPosition]="'above'"></mat-menu>
    `
  })
  class MyComponent {
    @ViewChild(MenuTrigger, {static: false}) menuTrigger !: MenuTrigger;
  }

  TestBed.configureTestingModule({declarations: [MyComponent, MenuTrigger, MatMenu]});
  const fixture = TestBed.createComponent(MyComponent);
  fixture.detectChanges();

  expect(fixture.componentInstance.menuTrigger.menu.yPosition).toBe('above');
});

I wonder whether this isn't an issue with packaging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: material/menu P2 The issue is important to a large percentage of users, with a workaround
Projects
None yet
Development

No branches or pull requests

3 participants