angular / angular/components

bug(button): overriding not working as expected.

Open
#31,475 1 comment 0 reactions 0 assignees View on GitHub
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

To override the background color for a button to a particular hex value provided, the state layer needs to be given an opacity of value 1. However, in doing so, the outline is no longer clearly visible. It appears to get hidden behind the state layer/ ::before pseudo element created.

### Reproduction

StackBlitz link: https://stackblitz.com/edit/wwtmsk43?file=src%2Fexample%2Fbutton-overview-example.css

Hover over the outline button to notice the outline no longer being visible.

### Expected Behavior

When opacity for the state layer is set to 1, the state layer for an outlined button should not hide the outline for the button. The outline should still be visible.

### Actual Behavior

The background's stacking context is higher than the button's stacking context which is hiding the border/ outline.

### Environment

- Angular: 20
- CDK/Material: 20

Contributor guide

Open the contributing guide

Research direction

Start with the linked StackBlitz reproduction and its src/example/button-overview-example.css, then inspect the button's state-layer and ::before stacking behavior. Done means hovering an outlined button with state-layer opacity 1 leaves its outline clearly visible while the supplied hex background override still works.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.