twbs / twbs/bootstrap

Insufficient contrast on borders

Open
#38,480 9 comments 13 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

accessibility color mode css design v5
Dominant language
MDX
Stars
175k
Forks
78.6k
Avg merge
7h 19m
Merged PRs (30d)
35

Description

Prerequisites
Describe the issue

WCAG 2.1 requires a contrast of 3:1 for non-text content. Many elements, e.g. form inputs or checkboxes, mostly consist of borders, at least in some of their states. It is therefore important that the border color has sufficient contrast to the background.

#888888 would have sufficient contrast to white. Bootstrap 5.2 uses #ced4da, which only has a contrast of 1.49 to white. Bootstrap 5.3 takes this even further by using #dee2e6 which only has a contrast of 1.3 to white.

I do not have any vision impairments that I know of, but to me these borders are practically invisible (depending on the lighting conditions). I strongly recommend to revert at least to the level of Bootstrap 5.2.

Bootstrap 5.3 introduces variables for the border color, so a workaround would be to set --bs-border-color: #888888.

Reduced test cases

#888888
Bootstrap 5.2.3
Bootstrap 5.3.0-alpha3

What operating system(s) are you seeing the problem on?

Linux

What browser(s) are you seeing the problem on?

Firefox

What version of Bootstrap are you using?

5.3.0-alpha3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file or test is named in the issue. Start by locating Bootstrap 5.3's default border-color variables and the components that use them, then compare their borders with the WCAG 2.1 non-text contrast requirement. Done means the default borders provide at least 3:1 contrast against their backgrounds without requiring a user override.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, html, scss
Domain
accessibility, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.