Ensure decent contrast in color-related utilities #34045
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #34016
Drafting this because it's valuable for Bootstrap's overall accessibility, just a I did with
:focus-visible
polyfill. Would regret not trying :)Inspired by Boosted, I still think this is highly valuable by getting decent contrasts for free using our utilities — and no more requiring eg.
.text-dark
alongside.bg-info
.Things to consider:
!important
to ease overrides, in order to still use.text-*
and.bg-*
together..bg-*
: since utilities are added last in our build,.bg-*
according color would override the component part's one if its selector is a class (or equivalent specificity).I didn't met such cases while working with Boosted for years so I'm pretty confident, however Bootstrap is a bit more popular and used :D
To do
If this PR gets positive feedback, before merging we'll need to:
.text-*
or.bg-*
throughout our docs (and examples)badge badge-info
from v4 tobadge bg-info
instead ofbadge bg-info text-dark
—and we'll probably find other cases.