Skip to content

Commit b3734cf

Browse files
authored
[A11y] Improved visibility of checkboxes when keyboard navigating a page (especially in high-contrast mode) (#8933)
* Bug fixed, made it a solid outline for greater visibility * Using an outline with a slight offset around checkboxes
1 parent a4c7733 commit b3734cf

3 files changed

Lines changed: 24 additions & 4 deletions

File tree

src/Bootstrap/dist/css/bootstrap.css

Lines changed: 9 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Bootstrap/less/forms.less

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@ input[type="checkbox"]:focus {
100100
.tab-focus();
101101
}
102102

103+
// Focus for checkboxes in forced-color modes (eg. Windows high-contrast mode)
104+
@media (forced-colors: active) {
105+
input[type="checkbox"]:focus {
106+
.forced-colors-tab-focus();
107+
}
108+
}
109+
103110
// Adjust output element
104111
output {
105112
display: block;

src/Bootstrap/less/mixins/tab-focus.less

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
// WebKit-specific. Other browsers will keep their default outline style.
55
// (Initially tried to also force default via `outline: initial`,
66
// but that seems to erroneously remove the outline in Firefox altogether.)
7-
outline: 5px auto -webkit-focus-ring-color;
7+
outline: 4px solid -webkit-focus-ring-color;
88
outline-offset: -2px;
99
}
10+
11+
.forced-colors-tab-focus() {
12+
// Specific to high-contrast mode, and other forced-color schemes
13+
// To override color changes in high-contrast mode, use "forced-color-adjust: none;"
14+
outline: 3px solid -webkit-focus-ring-color;
15+
outline-offset: 2px;
16+
}

0 commit comments

Comments
 (0)