Skip to content

bug(ELEVATION): Custom opacity for elevation not took in consideration #26004

Closed
@MikaStark

Description

@MikaStark

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.x.x

Description

Before v15, we could specify an opacity for a custom elevation like so :

@use "@angular/material" as mat;

.foo {
  @include mat.elevation(2, black, 0.36);
}

But since v15, opacity argument has been removed. Then I try to set opacity directly to the color like so :

@use "@angular/material" as mat;

.foo {
  @include mat.elevation(2, rgba(black, 0.36));
}

The resulting shadow is black as intendended but with a full opacity instead of 36%

Reproduction

Steps to reproduce:

  1. Add a dumb container like <div class="with-elevation">Hello world!</div>
  2. Add the following code to your styles.scss file
.with-elevation {
   @include mat.elevation(2, black);
}
  1. Observe
  2. Replace previous style code with the following
.with-elevation {
   @include mat.elevation(2, rgba(black, 0.36));
}
  1. Observe, you can see nothing changed

Expected Behavior

Opacity should be took in consideration

Actual Behavior

Opacity skipped and replaced

Environment

  • Angular: 15.0.0
  • CDK/Material: 15.0.0
  • Browser(s): any
  • Operating System (e.g. Windows, macOS, Ubuntu): any

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/core

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions