Skip to content
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.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Omitting the leading colon in a CSS rule containing parentheses breaks website #58

Open
okarmazin opened this issue Sep 2, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@okarmazin
Copy link

okarmazin commented Sep 2, 2024

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

@okarmazin okarmazin added the bug Something isn't working label Sep 2, 2024
@bitspittle bitspittle transferred this issue from varabyte/kobweb Sep 2, 2024
@bitspittle
Copy link
Contributor

This is not a bug with Kobweb. You have to know what you're doing when using cssRule.

That said, maybe we can explore doing syntax checking in the Kobweb IntelliJ Plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants