Search code examples
javascriptcssreactjsmozillacss-in-js

How to write Mozilla specific CSS using withStyles


I am developing a React application and using withStyles CSS in JS library for handling CSS. I am facing an issue in Mozilla where I have to change height attribute as per Mozilla browser. How can I change it using CSS in JS? Seems @-moz-document url-prefix() does not work in withStyles.

const styles = theme => ({
    radioGroupRoot : {
        backgroundColor : "#fff9d8",
        alignItems : "center",
        marginTop : '15px'
    },
    labelRoot : {
        margin : 0,
        width : "100%",
        alignItems : "end"
    },
    radioLabel : {
        width : "100%",
        backgroundColor: "#fff9d8"
    },
    radioRoot : {
        height : "37px",
        width : "37px",
        color : 'rgba(0, 0, 0, 0.7)'
    },
    '@-moz-document url-prefix()' : { 
        radioRoot : {
            height: '52px'
        }
    }
});

Solution

  • The @-moz-document CSS at-rule has been disabled with Firefox 61 to mitigate the risk of CSS injection attacks
    https://bugzilla.mozilla.org/show_bug.cgi?id=1449753

    try with

    @supports ( -moz-appearance:none ){
      /* Add firefox CSS code here */
    }