mui / mui/material-ui

[FloatingActionButton] Hover color wrong with custom colors

Open
#31,063 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

component: Fab scope: button
Dominant language
JavaScript
Stars
99.1k
Forks
32.5k
Avg merge
2d 17h
Merged PRs (30d)
106

Description

Duplicates
  • I have searched the existing issues

Related: #30665 #30846

Latest version
  • I have tested the latest version
Current behavior 😯

It gets white on hover

+ I get the error

Failed prop type: Invalid prop `color` of value `orange` supplied to `ForwardRef(Fab)`, expected one of ["default","error","info","inherit","primary","secondary","success","warning"].
Expected behavior 🤔

It should get a bit darker color than the normal state one

Steps to reproduce 🕹

https://codesandbox.io/s/floatingactionbuttons-material-custom-color-demo-0jt2n?file=/index.tsx

Context 🔦

I'm trying to create an accent color picker

Your environment 🌎

Tested with Firefox and Brave

`npx @mui/envinfo`
  System:
    OS: Linux 5.16 Arch Linux
  Binaries:
    Node: 16.13.2 - /usr/bin/node
    Yarn: 1.22.17 - /usr/bin/yarn
    npm: 8.4.1 - /usr/bin/npm
  Browsers:
    Chrome: Not Found
    Firefox: 97.0
  npmPackages:
    @emotion/react: ^11.7.1 => 11.7.1 
    @emotion/styled: ^11.6.0 => 11.6.0 
    @mui/base:  5.0.0-alpha.68 
    @mui/icons-material: ^5.4.1 => 5.4.1 
    @mui/material: ^5.4.1 => 5.4.1 
    @mui/private-theming:  5.4.1 
    @mui/styled-engine:  5.4.1 
    @mui/system:  5.4.1 
    @mui/types:  7.1.1 
    @mui/utils:  5.4.1 
    @mui/x-data-grid: ^5.5.1 => 5.5.1 
    @types/react: ^17.0.39 => 17.0.39 
    react: ^17.0.2 => 17.0.2 
    react-dom: ^17.0.2 => 17.0.2 
    typescript: ~4.5.5 => 4.5.5

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked CodeSandbox reproduction and inspect the FloatingActionButton handling of custom color values and hover styling. Confirm the behavior against the reported invalid color warning; done means custom colors remain valid and the hover state is a slightly darker version of the normal color without the warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
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.