components icon indicating copy to clipboard operation
components copied to clipboard

Mat-Menu doesn't stay attached to it's trigger when in a scrollable container

Open csidorenko opened this issue 7 years ago • 2 comments

Affected Package

@angular/material 7.3.7 @angular/animations 7.2.7 @angular/cdk 7.3.7

Is this a regression?

Unknown

Description

According to mat menu docs:

"The menu is attached to and opened via application of the matMenuTriggerFor directive"

The mat-menu-panel should be attached to it's trigger but when the trigger is absolute within a scrollable container, the mat menu doesn't scroll with the container and only scrolls with the entire window.

🔬 Minimal Reproduction

Have a component with a scrollable container. Within this container have a mat menu trigger with position absolute. It's container has position relative. Scroll container -> trigger stays in the right position and scrolls away but the mat menu panel stays in the same position relative to the window. https://stackblitz.com/edit/angular-5hrato

🌍 Your Environment

Angular Version: Angular CLI: 7.3.8 Node: 8.9.1 OS: win32 x64 Angular: 7.2.13 ... common, compiler, compiler-cli, core, forms, http ... platform-browser, platform-browser-dynamic, platform-server ... router

Package Version

@angular-devkit/architect 0.13.8 @angular-devkit/build-angular 0.13.8 @angular-devkit/build-optimizer 0.13.8 @angular-devkit/build-webpack 0.13.8 @angular-devkit/core 7.3.8 @angular-devkit/schematics 7.3.8 @angular/animations 7.2.7 @angular/cdk 7.3.7 @angular/cdk-experimental 7.3.7 @angular/cli 7.3.8 @angular/flex-layout 7.0.0-beta.19 @angular/material 7.3.7 @ngtools/webpack 7.3.8 @schematics/angular 7.3.8 @schematics/update 0.13.8 rxjs 6.4.0 typescript 3.2.4 webpack 4.29.0

csidorenko avatar May 31 '19 18:05 csidorenko

(revisiting older issues as part of a triaging fix-it)

There were two issue in the stackblitz:

  • The theme was missing, meaning that the overlay structual styles were absent
  • You have absolute positioning all buttons, which was affecting the menu items

When I fixed these, everything works as expected

jelbourn avatar May 27 '20 23:05 jelbourn

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.