You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Why does colorPrimary not exist in values.xml? Inconsistent Handling of colorPrimary and colorOnPrimary Attributes Between Material 1.12.0 and 1.13.0-alpha
#173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
There is a discrepancy in how the colorPrimary and colorOnPrimary attributes are handled between Material Components 1.12.0 and 1.13.0-alpha.
In Material 1.12.0:
colorPrimary is pulled from appcompat theme if it’s not explicitly defined in the Material Components theme.
colorOnPrimary and all other attributes are correctly handled by Material Components and pulled from its theme attributes.
In Material 1.13.0-alpha:
colorPrimary does not exists in Material Components, and trying to access it using com.google.android.material.R.attr.colorPrimary results in an error. It seems Material Components no longer provides colorPrimary, and the fallback to appcompat does not happen.
colorOnPrimary works as expected, but the behavior of colorPrimary has changed significantly, breaking backward compatibility.
Steps to Reproduce:
Implement Material Components 1.12.0 in your project.
Access colorPrimary and colorOnPrimary as follows:
In Material 1.12.0, colorPrimary will be pulled from appcompat if not explicitly defined, while colorOnPrimary will be correctly pulled from Material Components.
Switch to Material Components 1.13.0-alpha and try the same code.
colorPrimary will result in an error, as it’s not available in 1.13.0-alpha.
colorOnPrimary will still work.
Expected Behavior:
In both versions, colorPrimary should either be available in Material Components or should fall back to appcompat if not defined in the Material theme.
There should be no break in behavior when upgrading from 1.12.0 to 1.13.0-alpha regarding colorPrimary.
Actual Behavior:
In 1.12.0, colorPrimary falls back to appcompat.
In 1.13.0-alpha, colorPrimary is no longer available in Material Components, and trying to access it results in an error.
Possible Fix:
Ensure that colorPrimary is either consistently available in Material Components or explicitly falls back to appcompat to maintain compatibility.
Environment:
Material Components 1.12.0
Material Components 1.13.0-alpha
Android 11 and above
I'm not sure why colorPrimary attribute never existed in values.xml in all versions while all other attributes do exist.
Also colorError missing.
There is a discrepancy in how the colorPrimary and colorOnPrimary attributes are handled between Material Components 1.12.0 and 1.13.0-alpha.
In Material 1.12.0:
colorPrimary is pulled from appcompat theme if it’s not explicitly defined in the Material Components theme.
colorOnPrimary and all other attributes are correctly handled by Material Components and pulled from its theme attributes.
In Material 1.13.0-alpha:
colorPrimary does not exists in Material Components, and trying to access it using com.google.android.material.R.attr.colorPrimary results in an error. It seems Material Components no longer provides colorPrimary, and the fallback to appcompat does not happen.
colorOnPrimary works as expected, but the behavior of colorPrimary has changed significantly, breaking backward compatibility.
Steps to Reproduce:
Implement Material Components 1.12.0 in your project.
Access colorPrimary and colorOnPrimary as follows:
In Material 1.12.0, colorPrimary will be pulled from appcompat if not explicitly defined, while colorOnPrimary will be correctly pulled from Material Components.
Switch to Material Components 1.13.0-alpha and try the same code.
colorPrimary will result in an error, as it’s not available in 1.13.0-alpha.
colorOnPrimary will still work.
Expected Behavior:
In both versions, colorPrimary should either be available in Material Components or should fall back to appcompat if not defined in the Material theme.
There should be no break in behavior when upgrading from 1.12.0 to 1.13.0-alpha regarding colorPrimary.
Actual Behavior:
In 1.12.0, colorPrimary falls back to appcompat.
In 1.13.0-alpha, colorPrimary is no longer available in Material Components, and trying to access it results in an error.
Possible Fix:
Ensure that colorPrimary is either consistently available in Material Components or explicitly falls back to appcompat to maintain compatibility.
Environment:
Material Components 1.12.0
Material Components 1.13.0-alpha
Android 11 and above
I'm not sure why colorPrimary attribute never existed in values.xml in all versions while all other attributes do exist.
Also colorError missing.
I can explicity fix it with android.R.attr. like
I'm not sure about the consequences.
The text was updated successfully, but these errors were encountered: