Theme style precedence is hard to manage #309
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
With
9fa3bcafd0, themes can use more complicated selectors—which was often necessary—but that makes them subject to CSS's own precedence behavior again, which can be awkward and hard to predict. For example, the base theme defines a style for$$focused$light $cursor(.ID.cm-focused.cm-light .cm-cursor), and a theme that just styles$cursor, which would be a reasonable thing to do, will simply be overridden by the default cursor color.I'd be nice if real themes always override rules from base themes, but CSS doesn't have a good way to express that. Not sure how, short of adding a bunch of bogus classes to boost rules' precedence, to address this.
Attached patch always adds the main selector, making sure that theme-based selectors aren't shadowed by base + light/dark selectors. The general problem of CSS specificity isn't solved by that, so some care must still be taken, but it's less error-prone now.