Skip to content

Commit cbe3fb5

Browse files
langermankactions-uservdepizzol
authored
ActionList item outlines for high contrast theme (#1856)
* fresh branch * Stylelint auto-fixes * Create few-mice-scream.md * Update src/actionlist/action-list-item.scss Co-authored-by: Vinicius Depizzol <[email protected]> * change to box-shadow * lint * compromise * add reference * lint * fix merge, lint * adjust active state * lint * Stylelint auto-fixes * Update few-mice-scream.md Co-authored-by: Actions Auto Build <[email protected]> Co-authored-by: Vinicius Depizzol <[email protected]>
1 parent 815daff commit cbe3fb5

File tree

2 files changed

+27
-9
lines changed

2 files changed

+27
-9
lines changed

.changeset/few-mice-scream.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@primer/css": patch
3+
---
4+
5+
ActionList item outlines for high contrast theme

src/actionlist/action-list-item.scss

+22-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// stylelint-disable max-nesting-depth, selector-max-specificity
1+
// stylelint-disable max-nesting-depth, selector-max-specificity, selector-max-compound-selectors
22

33
@mixin focusOutline {
44
position: relative;
@@ -38,34 +38,50 @@
3838
}
3939

4040
// only hover li without list as children
41-
&:not(.ActionList-item--hasSubItem) {
41+
&:not(.ActionList-item--hasSubItem),
42+
// target contents of first child li if sub-item (li wraps item label + nested ul)
43+
&.ActionList-item--hasSubItem > .ActionList-content {
4244
@media (hover: hover) {
4345
&:hover {
4446
cursor: pointer;
4547
background-color: var(--color-action-list-item-default-hover-bg);
48+
49+
&:not(.ActionList-item--navActive) {
50+
// Support for "Windows high contrast mode"
51+
outline: $border-style $border-width transparent;
52+
outline-offset: -$border-width;
53+
// stylelint-disable-next-line primer/box-shadow
54+
box-shadow: inset 0 0 0 2px var(--color-action-list-item-default-active-border);
55+
}
4656
}
4757
}
4858

4959
&:active {
5060
background: var(--color-action-list-item-default-active-bg);
5161

62+
&:not(.ActionList-item--navActive) {
63+
// Support for "Windows high contrast mode" https://sarahmhigley.com/writing/whcm-quick-tips/
64+
outline: $border-style $border-width transparent;
65+
outline-offset: -$border-width;
66+
// stylelint-disable-next-line primer/box-shadow
67+
box-shadow: inset 0 0 0 2px var(--color-action-list-item-default-active-border);
68+
}
69+
5270
@media screen and (prefers-reduced-motion: no-preference) {
5371
animation: ActionList-item-active-bg 4s forwards cubic-bezier(0.33, 1, 0.68, 1);
5472
}
5573

56-
// stylelint-disable primer/box-shadow
5774
@keyframes ActionList-item-active-bg {
5875
50% {
59-
box-shadow: inset 0 0 0 rgba(#000, 0.04);
76+
// stylelint-disable-next-line primer/box-shadow
77+
box-shadow: inset 0 2px 12px 6px rgba(var(--color-canvas-default), 0.4);
6078
transform: scale(1);
6179
}
6280

6381
100% {
64-
box-shadow: inset 0 3px 9px rgba(#000, 0.04);
6582
transform: scale(0.97);
6683
}
6784
}
68-
// stylelint-enable primer/box-shadow
6985
}
7086

7187
// hide dividers
@@ -153,23 +169,20 @@
153169

154170
// has 16px leading visual
155171
.ActionList-content--visual16 + .ActionList--subGroup {
156-
// stylelint-disable-next-line selector-max-compound-selectors
157172
.ActionList-content {
158173
padding-left: $spacer-5;
159174
}
160175
}
161176

162177
// has 20px leading visual
163178
.ActionList-content--visual20 + .ActionList--subGroup {
164-
// stylelint-disable-next-line selector-max-compound-selectors
165179
.ActionList-content {
166180
padding-left: $spacer-2 * 4.5; // 36px
167181
}
168182
}
169183

170184
// has 24px leading visual
171185
.ActionList-content--visual24 + .ActionList--subGroup {
172-
// stylelint-disable-next-line selector-max-compound-selectors
173186
.ActionList-content {
174187
padding-left: $spacer-6;
175188
}

0 commit comments

Comments
 (0)