Skip to content

Commit b14d6be

Browse files
committed
update outline-hidden to only apply in forced colors mode
1 parent 356ae99 commit b14d6be

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

packages/tailwindcss/src/utilities.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14543,6 +14543,7 @@ test('outline', async () => {
1454314543
`,
1454414544
[
1454514545
'outline',
14546+
'outline-hidden',
1454614547

1454714548
// outline-style
1454814549
'outline-none',
@@ -14594,6 +14595,17 @@ test('outline', async () => {
1459414595
--color-red-500: #ef4444;
1459514596
}
1459614597
14598+
.outline-hidden {
14599+
outline-style: none;
14600+
}
14601+
14602+
@media screen and (forced-colors: active) {
14603+
.outline-hidden {
14604+
outline-offset: 2px;
14605+
outline: 2px solid #0000;
14606+
}
14607+
}
14608+
1459714609
.outline {
1459814610
outline-style: var(--tw-outline-style);
1459914611
outline-width: 1px;

packages/tailwindcss/src/utilities.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3850,10 +3850,15 @@ export function createUtilities(theme: Theme) {
38503850
return atRoot([property('--tw-outline-style', 'solid')])
38513851
}
38523852

3853-
staticUtility('outline-hidden', [
3854-
['outline', '2px solid transparent'],
3855-
['outline-offset', '2px'],
3856-
])
3853+
utilities.static('outline-hidden', () => {
3854+
return [
3855+
decl('outline-style', 'none'),
3856+
atRule('@media', 'screen and (forced-colors: active)', [
3857+
decl('outline', '2px solid transparent'),
3858+
decl('outline-offset', '2px'),
3859+
]),
3860+
]
3861+
})
38573862

38583863
/**
38593864
* @css `outline-style`

0 commit comments

Comments
 (0)