angular / angular/components

bug(mat-selection-list): Color attribute on (mat-list-option/mat-icon - matListItemIcon) is ignored on hover.

Open
#26,723 8 comments 1 reaction 0 assignees View on GitHub
area: material/icon area: material/list P3
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

_No response_

### Description

A mat-icon, located inside a mat-list-option, that has the matListItemIcon directive and has color="accent" (or other theming), loses its color when hovered.

Example:
```


play_arrow
{{pr.user.login}}
{{pr.title}}

```

### Reproduction

Steps to reproduce:
1. Add `color="accent"` to a mat-selection-list > mat-list-option > mat-icon (matListItemIcon)
2. Hover the icon.
3. Accent color goes away and is replaced by a default color.

### Expected Behavior

I would expect the accent color on mat-icon to stay when it is hovered. If the issue here is that for accessibility, hovered items need to visually identify, the background of the mat-list-option itself is already doing that.

### Actual Behavior

Theme colors are lost when the mat-list-option is hovered

### Environment

- Angular: 15
- CDK/Material: 15
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Windows

Contributor guide

Open the contributing guide

Research direction

Start with the Angular Material mat-selection-list and mat-list-option implementation and its hover styling, then reproduce the issue using the provided mat-icon matListItemIcon example in Angular/Material 15. Trace which hover rule overrides the icon's color attribute and add or update the relevant component test if one is present; done means the accent color remains visible while hovering.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.