CSS: Improve browser compatibility by replacing from ... r g b syntax#11939
CSS: Improve browser compatibility by replacing from ... r g b syntax#11939danielchalmers merged 4 commits intoMudBlazor:devfrom
from ... r g b syntax#11939Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR fixes browser compatibility issues by replacing the CSS rgb(from var(...) r g b / alpha) syntax with the more widely supported rgba() syntax, addressing issue #11936.
Key changes:
- Replace all
rgb(from var(--color) r g b / opacity)withrgba(var(--color-rgb), opacity) - Add corresponding
-rgbCSS custom properties to the theme provider for color values in RGB format - Update test files to reflect the new CSS custom properties
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
_togglegroup.scss |
Updated border-color properties to use rgba syntax |
_chip.scss |
Updated border property to use rgba syntax |
_buttongroup.scss |
Updated multiple border properties to use rgba syntax |
_button.scss |
Updated border properties in outlined button styles to use rgba syntax |
_avatar.scss |
Updated border properties in outlined avatar styles to use rgba syntax |
_alert.scss |
Updated border properties in outlined alert styles to use rgba syntax |
MudThemeProvider.razor.cs |
Added generation of RGB format CSS custom properties for text and divider colors |
ThemeProviderTests.cs |
Updated test assertions to include new RGB format CSS properties |
| Test razor files | Updated background-color properties in test components to use rgba syntax |
| Dialog example | Updated background properties to use rgba syntax |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Code Review
This pull request is a good initiative to improve browser compatibility by replacing the rgb(from ...) CSS syntax with the more widely supported rgba(...) syntax. This is achieved by introducing new CSS variables with an -rgb suffix. The changes are applied consistently across the codebase.
I've found one critical issue where a new CSS variable is used but not generated, which will break styling in one of the examples. I've also noticed a minor file encoding issue in two test files where a BOM character was introduced. My review includes suggestions to fix these points.
src/MudBlazor.Docs/Pages/Components/Dialog/Examples/DialogStylingExample_Dialog.razor
Show resolved
Hide resolved
...sts.Viewer/TestComponents/DataGrid/DataGridVirtualizeServerDataLoadingLargeDataSetTest.razor
Show resolved
Hide resolved
...Tests.Viewer/TestComponents/DataGrid/DataGridVirtualizeServerDataLoadingWithSearchTest.razor
Show resolved
Hide resolved
from r g b syntaxfrom ... r g b syntax
from ... r g b syntaxfrom ... r g b syntax on border colors
from ... r g b syntax on border colorsfrom ... r g b syntax
from ... r g b syntaxfrom ... r g b syntax
CSS: Use pre-computed values instead of
from ... r g bsyntax on border colorsFixes #11936 by using an older syntax that is more widely supported.
Checklist:
dev).