specificity icon indicating copy to clipboard operation
specificity copied to clipboard

Show error message on syntax error

Open FeldrinH opened this issue 1 year ago • 2 comments

Currently inputting a syntactically invalid CSS selector shows a specificity of 0 with no error (except in the devtools console), which might create confusion, if you don't realize it is invalid. It would be clearer to show an error message instead of all zeros.

Edit: In most cases you can infer that there is a syntax error just by noting that the specificity should be more than 0, but that is not the case with for example the selector :where(div), which is valid but has a specificity of 0.

FeldrinH avatar Jul 26 '23 20:07 FeldrinH

Hi @FeldrinH, thanks for the issue. I agree the website does not convey invalid selectors very well. But the problem with showing an error message is the specificity (and validity) of input is calculated on every keypress. It could be annoying if an error message pops up before a user has even finished entering their input.

keeganstreet avatar Jul 30 '23 09:07 keeganstreet

Maybe a little error icon can appear, and the error message only displays when the error icon is clicked

keeganstreet avatar Jul 30 '23 09:07 keeganstreet