Skip to content

Commit ec7d402

Browse files
authored
Fix missing outline on dark-mode Card components (#785)
* fix missing focus outline on dark-mode Cards * add changeset * fix typo * update snapshots
1 parent c098fb6 commit ec7d402

File tree

4 files changed

+20
-10
lines changed

4 files changed

+20
-10
lines changed

.changeset/thick-numbers-play.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/react-brand': patch
3+
---
4+
5+
Fixed bug in `Card` component which caused the focus outline to not display when in dark-mode

packages/react/src/Card/Card.features.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ MinimalDark.decorators = [
3535

3636
export const CTAText: StoryFn<typeof Card> = () => {
3737
return (
38-
<Card ctaText="Dicover how" href="https://github.com">
38+
<Card ctaText="Discover how" href="https://github.com">
3939
<Card.Heading>GitHub Actions cheat sheet</Card.Heading>
4040
<Card.Description>
4141
In a recent TechTarget study, 70 percent of organizations reported they had adopted DevOps.

packages/react/src/Card/Card.module.css

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,6 @@
3535
background-color: var(--brand-Card-background-default);
3636
}
3737

38-
.Card:focus-within {
39-
outline: var(--brand-borderWidth-thick) solid var(--brand-color-focus);
40-
}
41-
42-
.Card--variant-minimal:focus-within {
43-
outline-offset: var(--base-size-16);
44-
}
45-
4638
.Card:hover {
4739
text-decoration: none;
4840
}
@@ -73,6 +65,15 @@
7365

7466
.Card__outer {
7567
height: 100%;
68+
border-radius: var(--brand-borderRadius-large);
69+
}
70+
71+
.Card__outer:focus-within {
72+
outline: var(--brand-borderWidth-thick) solid var(--brand-color-focus);
73+
}
74+
75+
.Card__outer:has(.Card--variant-minimal):focus-within {
76+
outline-offset: var(--base-size-16);
7677
}
7778

7879
.Card--icon {
@@ -269,17 +270,21 @@
269270

270271
.Card--skew {
271272
height: 100%;
272-
overflow: hidden;
273273
border-radius: var(--brand-borderRadius-large);
274274
}
275275

276+
.Card--skew:focus-within {
277+
outline: var(--brand-borderWidth-thick) solid var(--brand-color-focus);
278+
}
279+
276280
.Card--skew:hover .Card__torch {
277281
opacity: 0.85;
278282
}
279283

280284
.Card__skew-bounding {
281285
border-radius: var(--brand-borderRadius-large);
282286
position: relative;
287+
overflow: hidden;
283288
z-index: 1;
284289
height: 100%;
285290
background-color: var(--brand-Card-background-default);
276 Bytes
Loading

0 commit comments

Comments
 (0)