components icon indicating copy to clipboard operation
components copied to clipboard

bug(MatButton): FAB with disabled state using alpha on background collisions

Open tomasdev opened this issue 2 years ago • 2 comments

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

Screenshot 2023-12-15 at 2 33 55 PM

Because the disabled state background color is defined with alpha, FAB collide with page contents when disabled. There's no guideline anywhere stating that FAB should never get disabled, and a disabled FAB is even part of the documentation.

FAB stands for Floating Action Button according to https://m3.material.io/components/floating-action-button/overview so it should be assumed most uses will be with absolute or fixed positioning.

Reproduction

StackBlitz link: https://stackblitz.com/edit/4rnhsm?file=src%2Findex.html,src%2Fexample%2Fbutton-overview-example.html,src%2Fexample%2Fbutton-overview-example.css Steps to reproduce:

  1. Have a FAB button
  2. Make it disabled

Expected Behavior

The button doesn't get visually mixed with the page contents. One potential solution would be to make the disabled state not use alpha.

Actual Behavior

Page contents as partially visible background on the button decrease its readability.

Environment

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

tomasdev avatar Dec 15 '23 19:12 tomasdev

To work around this problem in the meantime, you can place the fab in a container with a white background color https://stackblitz.com/edit/4rnhsm-fbbxhq

wagnermaciel avatar Dec 15 '23 19:12 wagnermaciel

Alternative workaround (which we used) is --mdc-filled-button-disabled-container-color: some-solid-color

tomasdev avatar Dec 15 '23 19:12 tomasdev