Skip to content

Provide syntax checking for cssRule #58

Description

@okarmazin

If you declare a raw CSS selector containing parentheses, such as nth-child(even), without the leading colon, website output will be broken (I have no better word to describe this). Omitting the colon on selectors without parens (hover) doesn't lead to breakages.

Very easily reproducible:

  1. kobweb create app
  2. Replace the HomeGridCellStyle in Index.kt with the following block.
  3. Start the dev server and observe the differences in website behavior when adding and removing the colon in nth-child
val HomeGridCellStyle = CssStyle {
    base {
        Modifier
            .backgroundColor(GridCellColorVar.value())
            .boxShadow(blurRadius = 0.6.cssRem, color = GridCellColorVar.value())
            .borderRadius(1.cssRem)
    }
    cssRule("nth-child(even)") {
        Modifier.backgroundColor(org.jetbrains.compose.web.css.Color.chartreuse)
    }
    cssRule(":hover") {
        Modifier.backgroundColor(org.jetbrains.compose.web.css.Color.crimson)
    }
}

Version: 0.19.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions