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

Potential lack of specificity with colour rules; false positives #198

Open
ColonelGerdauf opened this issue Oct 27, 2022 · 2 comments
Open
Labels

Comments

@ColonelGerdauf
Copy link
Contributor

There are rules such as div[style*="background: #FFF"]. That causes awkwardness for situations like when colour is #FFFAF0

That would make the colour swatch for 'floral white' [Citation] disappear due to the faulty match clause.

And with that specific example, I have noticed the exact same rule in different sets, which creates potentially conflicting rules.

@ColonelGerdauf
Copy link
Contributor Author

Maybe a :not(.color_swatch) > div[style*="background: #000"] can help in those kinds of situations.

@AfroThundr3007730
Copy link
Member

Yeah that's a problem with how we have to match the inline styles on the elements. Wikipedia, and other MediaWikis by nature, have an overabundance of inline styles that make targeting and overriding them with CSS rather difficult. This is especially true when you're trying not to break other elements of the page, or other unrelated pages in the process. There are a lot of over or under specified selectors exacerbated by !important (and :not() as you suggest above).

Things have gotten better with the adoption of TemplateStyles for most common templates, but WikiTables with inline styles and other types of inline elements are still prevalent everywhere. This will continue to be the case as long as editors are manipulating styles with their edits.

There is also a lot of legacy baggage with how this user style is structured. The MediaWiki interface changes constantly, and older style overrides aren't always removed when that happens. An attempt to rewrite it from scratch and structuring it with the goal of minimizing these malformed selectors and reducing collateral damage would be a massive undertaking, given the complexity of MediaWiki in general, and Wikipedia in particular.

This is one of the reasons we decided that a style generator similar to GitHub-Dark would be the best path forward, though none of us have had much time lately to make progress on that front. If you're interested in tackling the specificity problem (or any other issues), feel free to submit a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants