Skip to content

MudIconButton: Fix filled buttons losing background color on click#11944

Merged
danielchalmers merged 3 commits intoMudBlazor:devfrom
igotinfected:fix/filled-icon-buttons-lose-filled-hover-color-when-clicked
Oct 9, 2025
Merged

MudIconButton: Fix filled buttons losing background color on click#11944
danielchalmers merged 3 commits intoMudBlazor:devfrom
igotinfected:fix/filled-icon-buttons-lose-filled-hover-color-when-clicked

Conversation

@igotinfected
Copy link
Member

Fixes: #11930

Filled icon buttons didn't have the correct background color after being clicked because we were using --mud-palette-action-default-hover as color. For filled icon buttons we now use the same method as for normal buttons, which is to define the background color based on the filled color class applied to the component.

Using icon buttons via keyboard navigation didn't trigger this issue because the hover color would take effect instead, hence why I didn't notice it.

Checklist:

  • The PR is submitted to the correct branch (dev).
  • My code follows the style of this project.
  • I've added relevant tests or confirmed existing ones.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request addresses an issue where filled icon buttons incorrectly displayed their background color upon being clicked. The fix aligns the behavior of filled icon buttons with that of standard filled buttons by applying the correct background color for :active and :focus-within states. The change is logical and effectively resolves the bug. I've included one suggestion to enhance the new SCSS rule for better performance and specificity.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a visual bug where filled MudIconButton components were losing their proper background color when clicked, reverting to a default hover color instead of maintaining the theme-appropriate color.

  • Adds specific styling for filled icon buttons in the :focus-within and :active states
  • Uses the same color logic as regular buttons by applying the appropriate darken variant based on the color class

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@danielchalmers danielchalmers merged commit c98bd0e into MudBlazor:dev Oct 9, 2025
6 checks passed
@igotinfected igotinfected deleted the fix/filled-icon-buttons-lose-filled-hover-color-when-clicked branch October 9, 2025 21:15
Copy link

@joe10832 joe10832 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Unexpected behavior or functionality not working as intended regression Previously worked and now doesn't

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MudIconButton | Fill disapperas on click

4 participants