Skip to content

Commit 21bc7e2

Browse files
authored
fix: Styles not applied for :visited and :active inline links (#504)
1 parent eb59cbd commit 21bc7e2

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

src/stories/A.stories.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,18 @@ export default {
88
function Template(args: any) {
99
return (
1010
<Flex gap="medium">
11-
<A {...args} />
11+
<A
12+
href="#"
13+
{...args}
14+
/>
1215
<A
1316
href="https://github.com"
1417
{...args}
1518
>
1619
Github
1720
</A>
1821
<A
22+
href="#"
1923
inline
2024
{...args}
2125
>

src/theme/marketingText.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ const marketingTextPartials = {
102102
},
103103
'&:visited, &:active': {
104104
color: semanticColorCssVars['action-link-inline-visited'],
105+
'&:hover': {
106+
color: semanticColorCssVars['action-link-inline-visited-hover'],
107+
},
105108
},
106109
},
107110
navLink: {

src/theme/text.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,17 +156,23 @@ const textPartials = {
156156
textOverflow: 'ellipsis',
157157
},
158158
inlineLink: {
159+
// Intermediate variables needed to avoid mangling by Honorable
160+
// Must declare all intermediate color variables at style root due to
161+
// security restritions on setting properties for :visited pseudo-class
159162
'--inline-link-c': semanticColorCssVars['action-link-inline'],
163+
'--inline-link-c-h': semanticColorCssVars['action-link-inline-hover'],
164+
'--inline-link-c-v': semanticColorCssVars['action-link-inline-visited'],
165+
'--inline-link-c-v-h':
166+
semanticColorCssVars['action-link-inline-visited-hover'],
160167
color: `var(--inline-link-c)`,
161168
textDecoration: 'underline',
162169
'&:hover': {
163-
'--inline-link-c': semanticColorCssVars['action-link-inline-hover'],
170+
color: 'var(--inline-link-c-h)',
164171
},
165172
'&:visited, &:active': {
166-
'--inline-link-c': semanticColorCssVars['action-link-inline-visited'],
173+
color: 'var(--inline-link-c-v)',
167174
'&:hover': {
168-
'--inline-link-c':
169-
semanticColorCssVars['action-link-inline-visited-hover'],
175+
color: 'var(--inline-link-c-v-h)',
170176
},
171177
},
172178
},

0 commit comments

Comments
 (0)