angular / angular/components

bug(menu): Overflow behaviour does not match the documentation

Open
#26,807 4 comments 0 reactions 0 assignees View on GitHub
area: material/menu P2
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

### Is this a regression?

- [ ] Yes, this behavior used to work in the previous version

### The previous version in which this bug was not present was

14

### Description

The behaviour when a menu button label has a long work (that can't be broken) is different in a newly created app than on the Angular Material demo page.

The `overflow: hidden` on `.mdc-list-item__primary-text` appears to be missing.

Material documentation page edited to make the label longer:

![image](https://user-images.githubusercontent.com/375694/225961116-ad806371-cd54-44f9-98be-536df1a50ba4.png)

App that copies the same code:

![image](https://user-images.githubusercontent.com/375694/225961374-2f96e965-ecb1-455b-aa7e-65f807775b6f.png)

### Reproduction

Steps to reproduce:
1. https://components-issue-5kgmsj.stackblitz.io (this is a copy of the code from the `basic menu` example but with a long label)
2. click to open the menu
3. the label overflows the content instead of getting an ellipsis

### Expected Behavior

Ellipsis

### Actual Behavior

Overflows

### Environment

- Angular: 15.2.3
- CDK/Material: 15.2.3
- Browser(s): all
- Operating System (e.g. Windows, macOS, Ubuntu): mac

Contributor guide

Open the contributing guide

Research direction

Start with the Angular Material menu implementation and its styles, searching for `.mdc-list-item__primary-text` and the basic menu example referenced in the report. Reproduce the long, unbreakable label in the linked StackBlitz app and compare it with the documentation demo. Done means the label is clipped with an ellipsis rather than overflowing.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
Half a day
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.